错误: [$injector:unpr] 未知提供程序: a.
Error: [$injector:unpr] Unknown provider: a
这是我的代码:
app.factory('assignmentAttachments', function() {
});
describe("test", function() {
// arrange variable
var assignmentAttachments;
// inject service
beforeEach(inject(function(_assignmentAttachments_) {
assignmentAttachments = _assignmentAttachments_;
}));
describe("test", function() {
it("test", function() {
// arrange
})
});
});
我收到以下错误:
错误: [$injector:unpr] 未知提供程序: 分配附件提供程序<- 分配附件 http://errors.angularjs.org/1.2.27/$injector/unpr?p0=assignmentAttachmentsProvider%20%3C-%20assignmentAttachments
确保已导入注册assignmentAttachments
的模块。例如,如果在app
模块中注册了assignmentAttachments
,如下所示:
var app = angular.module('app', [])
app.factory('assignmentAttachments', ...});
然后,您必须在测试中导入该模块:
describe("test", function() {
...
beforeEach(module('app')); // <== add this line
// inject service
beforeEach(inject(function(_assignmentAttachments_) {
assignmentAttachments = _assignmentAttachments_;
}));
});
相关文章:
- 为什么我得到错误:$injector:unp未知提供程序
- 在出厂时注入服务错误: [$injector:unpr] 未知提供程序: $scopeProvider <- $scop
- AngularJS错误:$injector:unp未知提供程序-$modalInstanceProvider
- AngularJS:未知的提供程序错误
- Angular小部件中的Angular Grid返回错误:[$injector:unp]未知提供程序:
- 有角度的“;未知提供者”;在约曼应用程序中使用Grunt Build缩小后出错
- 获取解析值的未知提供程序错误
- $provide.decorator为指令提供未知的提供程序
- jQuery - 追加/替换事件侦听器(当事件处理程序未知时)
- angular.js:13294错误:[$injector:unp]未知提供程序:cityResourceProvide
- 角度未知提供程序,无法POST/注册
- 未知提供程序:在angular.bootstrap之前使用$injector获取$location服务时使用$rootE
- Watir Web驱动程序引发未知Javascript错误
- ionic.bundle.js:25642错误:[$injector:unp]未知提供程序:$cordovaGeoloc
- 密钥斗篷未知提供程序错误
- Angular 未知提供程序,出厂时包装在匿名函数中
- ui选择未知提供程序
- 错误: [$injector:unpr] 未知提供程序: setPageProvider <- setPage
- (IONIC)错误: [$injector:unpr] 未知提供程序: 数据服务提供程序 <- 数据服务<- 身份验证控
- AngularJS 未知提供程序