【发布时间】:2016-11-08 18:35:09
【问题描述】:
因为每个部分模板都被缓存了,我不想这样做
.directive('myMessages', [ function () {
return {
restrict : 'E',
templateUrl : 'wwwroot/base/messages/ui.partial.messages.show.html?v' + Date.now(),
是否可以全局覆盖templateUrl 函数并在末尾添加日期?
我也尝试了论坛中的这两种解决方案,但它们从未被触发:
$rootScope.$on('$routeChangeStart', function(event, next, current) {
$templateCache.remove(current.templateUrl);
});
$rootScope.$on('$viewContentLoaded', function() {
$templateCache.removeAll();
});
【问题讨论】:
-
你把代码放在哪里了?我在我的 app.run 函数中或多或少做同样的事情,它工作正常,每次加载视图时它都会运行。
标签: angularjs