【发布时间】:2015-07-02 14:13:52
【问题描述】:
我的 AngularJS 项目包含 20 多个 html 模板(路由、模式)。
我正在使用 grunt-angular-templates 将模板拆分到一个文件 templates.js 中。
在我的 Angular 项目中,我使用 angular-route 1.2.25 进行路由。
当我尝试使用 templates.js 文件中的模板时,浏览器崩溃并且没有响应。控制台有任何错误。
问题仅在于带有 Angular 内容的 html 模板(ng-switch、ng-show 等) 当我加载干净的 html 时,它可以工作。
我认为问题在于从 $templateCache 编译模板,但是如何管理它?
Templates.js
...
$templateCache.put("name","HTML");
...
【问题讨论】:
-
你能分享更多关于你的项目结构和
angular-templates任务的grunt配置的信息