1. 程式人生 > >解決AngularJs 快取問題

解決AngularJs 快取問題

因為AngularJS的特性,經常需要清除瀏覽器的快取來保證瀏覽器去獲得最新的html模板

解決方法:https://stackoverflow.com/questions/24577945/angularjs-directive-templateurl-doesnt-update/24578333#24578333

The reason for that is that Angular fetch a file only once at the begining. You can try to use templateUrl as function and append timestamp so you get new template url each time.

templateUrl:function(){return'partials/app-mainsec.html?'++newDate();}

But probably, it will refresh your directive only when directive will be compiled.