【发布时间】:2018-07-30 18:56:15
【问题描述】:
Angular 5 Web App - 总是加载缓存版本或旧版本我应该按 ctrl + f5 来获取新版本并清除缓存。 我找到了这个解决方案
@Component({
selector: 'csj-app',
templateUrl: 'app/component/app.component.html?v=1.0',
styleUrls: ['style/app.css?v=1.0']
})
但是当我使用 aot 构建时出现此错误
ERROR in : Couldn't resolve resource app.component.html?v=1
【问题讨论】:
-
为什么要在模板和样式链接中添加url参数?
-
你在使用 angular-cli 吗?如果是这样,这只会在运行开发构建时成为问题。使用 angular-cli >= 1.5 时,生产版本将接收模块和样式的哈希值。对于开发,您可以将浏览器设置为不在开发工具中缓存。
-
我添加url参数以在更新后加载新版本。
-
我很确定你不能在那里这样做,你只能在路由中添加参数
标签: angular angular2-template angular5