本文介绍了ngMockE2E导致每个请求嘲笑加入到依赖的那一刻的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我
angular.module("myModule", [
//Some dependency
"ngMockE2E"
])
这实际上是嘲讽模板的要求和投掷误差
This is actually mocking template request and throwing error
Unexpected request: GET javascripts/custom/utils/templates/global_loader.html
No more request expected
at $httpBackend (angular-mocks.js?e_a_v=5:1226)
at sendReq (angular.js?e_a_v=5:10215)
at $get.serverRequest (angular.js?e_a_v=5:9927)
at processQueue (angular.js?e_a_v=5:14437)
at angular.js?e_a_v=5:14453
at Scope.$get.Scope.$eval (angular.js?e_a_v=5:15702)
at Scope.$get.Scope.$digest (angular.js?e_a_v=5:15513)
at Scope.$get.Scope.$apply (angular.js?e_a_v=5:15807)
at bootstrapApply (angular.js?e_a_v=5:1628)
at Object.invoke (angular.js?e_a_v=5:4426)
如果我注释掉ngMockE2E,它工作正常。
任何知道我做错了?
If I comment out ngMockE2E, it works fine.Any idea what I am doing wrong?
推荐答案
ngMockE2E
引入的所以是的,所有的HTTP请求嘲笑。要允许加载你的模板,添加到您的模块
ngMockE2E
introduces $httpBackend
so yes, all HTTP requests are mocked. To allow your templates to be loaded, add this to your module
.run(function($httpBackend) {
// pass through template requests
$httpBackend.whenGET(/\.html$/).passThrough();
});
这篇关于ngMockE2E导致每个请求嘲笑加入到依赖的那一刻的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!