Javascript 错误:[$injector:unpr]未知提供程序:a
这是我的密码:Javascript 错误:[$injector:unpr]未知提供程序:a,javascript,angularjs,jasmine,Javascript,Angularjs,Jasmine,这是我的密码: app.factory('assignmentAttachments', function() { }); describe("test", function() { // arrange variable var assignmentAttachments; // inject service beforeEach(inject(function(_assignmentAttachments_) { assignment
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]未知提供程序:
assignmentAttachmentsProvider确保已导入注册了
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_;
}));
});
描述(“测试”,函数(){
...
在每个(模块(“应用”)之前//