I am using AngularJS and have implemented routing using it. I want to make sure whenever route changes template is fetched from server and not obtained from cache, is there a way I can force this to happen ?
2 Answers
This should hopefully work:
app.run(function($rootScope, $templateCache) {
$rootScope.$on('$viewContentLoaded', function() {
$templateCache.removeAll();
});
});
2 Comments
Jyoti Puri
Thanks your fix is working but I get following error as mu page loads: TypeError: Cannot read property 'removeAll' of undefined at localhost:8080/ui/app/js/angular/app.js:294:21
Jyoti Puri
putting a null check for $templateCache helped...thanks