I do the application on Angular. The templates specified in $ routeProvide are NOT cached, and caching of directive templates cannot be done in any way. That is, if I make any changes to the directive template, or delete it altogether, then after updating the page, the application looks the same if it doesn’t clear the browser’s cache. How to make html directive templates always pull up from the server and not be taken from the cache?

In the image, the topmost html file is downloaded from the server, and the rest 4 are templates of directives. They are taken from the cache. (from cache)

  • Exactly sins js, not a server? - Pleshevskiy

1 answer 1

Probably, adding such a string to the module's run method will help.

$templateCache.removeAll(); 

Example:

 app.run(['$templateCache', '$rootScope', function ($templateCache, $rootScope) { $rootScope.$on('$stateChangeStart', function () { $templateCache.removeAll(); }); });