2017-02-06 51 views
1

试图用花哨的es6 /模块的东西启动一个新项目。我使用的是一饮而尽,ngAnnotate,browserify,角templatecache,等等......总之,我想实际运行我的基地设置及其Angular无法从templatecache加载模板无用的错误

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包含我试图获得的模板。我能做

$templateCache.get('components/unauthenticated-container/unauthenticated-container.component.html'); 

并得到我期待的模板。我不确定上述错误中的(HTTP status: undefined undefined)是什么意思。生成的文件来填充templateCache看起来是正确的对我说:

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");}]); 

有什么明显我缺少什么的,我可以试试吗?

回答

2

原来,我在其中一个拦截器中发生了错误,而$ http未显示错误。

+0

在我的情况下的错误是由于美元注射器不能解决依赖 –