It's there any new attempt to allow dynamically change the manifest of an Angular PWA based on, let's say, the URL used?
I have found two tries at https://medium.com/@alshakero/how-to-setup-your-web-app-manifest-dynamically-using-javascript-f7fbee899a61 but none it's really working.
We built a platform that we need to customize based on the company using the on-line service. It is just a small and humble almost free service but this feature will be of great value.
Happy coding :)
Josep.
Answering on an old, but in my view still a relevant question.
As is probably already clear, there's two ways and it is a matter of principle which you should attempt.
You mentioned that the hot-swap (javascript) solution is not really working. You need to specify why that is not working. Is it not dynamic enough? Because in that case it is a matter of requesting your server for the data you want in the manifest. Or is it simply not working as stated? Maybe a storage/cache is holding you back. This could be related to NgSw or @angular/pwa already being loaded. Sometimes you gotta clear some cache to really dynamically switch between manifest or theme. State your requirements in that case!
Let the server decide which manifest to provide. This has a lot of advantages. For one you don't have to build the Angular app for a specific purpose as it is URL/domain agnostic. We all usually begin with configuring the Angular app (f.e. environment.*.ts
) but in the end reverting that change as it is another thing to keep in sync
when you have many different environments/URL's or deployments. I advise to keep the app as static and predictable as possible, but loading any change before the app 'bootstraps' in main.ts
or even in index.html
through the first step.
If you provide us the server you run, we can in return provide tips on how to tackle that. NodeJS/.NET Core/PHP/Spring/... it is just a matter of how and not what.