Search code examples
angulartypescriptangular-clibroadcast

Notify user after deploying new app build in Angular 2 with Angular CLI


I use angular cli and I want to notify user after deploying a newer version of the app.
So far I tried replace-in-file and an external js file which I run before building the app,
in order to pass the current date to the environment file and then use it inside the app .
I am checking the date with the last date on browser's local storage but the app still has to be updated to get the new environment's date.
Any suggestions on how to do it differently would be welcome!! Thank you!


Solution

  • Angular version 5 has introduced a solution to this using Service Workers.

    Service Workers are supported currently (Jan 2018) in Chrome and Firefox and coming soon in Safari, Opera.