首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Angular无法从模板缓存加载模板无用错误

Angular无法从模板缓存加载模板无用错误
EN

Stack Overflow用户
提问于 2017-02-06 21:59:05
回答 1查看 729关注 0票数 2

尝试使用奇特的ES6/模块开始一个新项目。我使用了gulp,ngAnnotate,browserify,angular-templatecache,等等。无论如何,我正在尝试实际运行我的基本设置和它

代码语言:javascript
复制
Error: [$compile:tpload] Failed to load template: components/unauthenticated-container/unauthenticated-container.component.html (HTTP status: undefined undefined)
http://errors.angularjs.org/1.6.1/$compile/tpload?p0=components%2Funauthent…ainer%2Funauthenticated-container.component.html&p1=undefined&p2=undefined
    at angular.js:68
    at l (angular.js:19730)
    at s (angular.js:16648)
    at angular.js:16692
    at d.$eval (angular.js:17972)
    at d.$digest (angular.js:17786)
    at d.$apply (angular.js:18080)
    at angular.js:1841
    at Object.a [as invoke] (angular.js:4842)
    at a (angular.js:1839)

我不能理解的是,如果我在$templateRequest中放了一个断点,$templateCache就会包含我想要获取的模板。我能做到

代码语言:javascript
复制
$templateCache.get('components/unauthenticated-container/unauthenticated-container.component.html');

得到我想要的模板。我不确定上面错误中的(HTTP status: undefined undefined)到底是什么意思。生成的用于填充templateCache的文件在我看来是正确的:

代码语言:javascript
复制
angular.module("templates", []).run(["$templateCache", function($templateCache) {$templateCache.put("components/authenticated-container/authenticated-container.component.html","<div>Authenticated</div>\n");
$templateCache.put("components/unauthenticated-container/unauthenticated-container.component.html","<div>\n  <div ui-view></div>\n</div>\n");}]);

有没有什么明显的我遗漏的或者我可以尝试的?

EN

回答 1

Stack Overflow用户

发布于 2017-02-06 23:17:00

原来我的一个拦截器有一个错误,而$http没有发现这个错误。

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42069586

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档