解决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?' + +new Date();
}

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


你可能感兴趣的:(angular,js,angular)