[英]How to fix template paths in templateCache? (gulp-angular-templatecache)
[英]Template is not taken from $templateCache
我有这段代码https://gist.github.com/domakas/8b574aa919e64085c569
问题是,当我编译元素时,它不会从$ templateCache加载模板。 实际上,它不会触发链接或控制器回调。 控制台中没有错误,只是在到达链接回调时它似乎停止工作。 如果我在编译之前尝试$templateCache.get('../templates/companySelector.html')
,我会看到那里有模板。
我已经设置了伊斯坦布尔,所以我可以清楚地看到,该链接未执行。 '../templates/companySelector.html'模块由ng-html2js生成,测试由业力运行。
在主旨中,模板网址为:
templateUrl: '../templates/companySelector.html'
但是,您说模板位于src/templates/companySelector.html
。
请检查要点,确保基于您正在运行的“索引”页面而不是指令代码库的位置,来确定要旨内的路径是正确模板的实际路径。
经过大量调查,我设法发现根本没有提出模板请求,由于请求是异步的,因此仅在实际查找了刷新缓存并刷新之后才需要刷新它(与刷新任何$ http请求相同)。使用。 因此,在元素编译后使用$httpBackend.flush()
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.