I have built a largely directive-based AngularJS HTML5 application. Each directive will load it's template from another file, using the templateUrl
syntax.
The application is a single-page application, let's pretend it's accessible via http://prod/index.html
, and when that page is loaded a directive will then load http://prod/partials/directive-a.html
I'm having problems when pushing out new releases of the website to my production enviroment. The browser is continuing to use cached assets from the previous version.
For example, if I navigate to http://prod
, all the assets are shown from the previous version. If I force-refresh the page (CTRL+F5
), the index.html page will be re-loaded from the server and reflect any changes.
This does not cause the browser to refresh the partials/directive-a.html
. Therefore, the new index.html
page still shows the old directive-a.html
.
If I navigate to the full partial HTML file (partials/directive-a.html
) in the browser address bar, the old version of the partial is presented to me. By hard-refreshing the partial page the correct (new) version of the partial will be shown, and also be updated when the directive on index.html
is reloaded.
What mechanisms are available to me to prevent the caching of partials?
I've seen commentary about appending a timestamp to the query arguments, but this seems overly clunky to put on all of my directives and routes.