0
我已经叫服务称为“泛函”功能ServiceA也许还可以利用在服务中定义一个函数在另一个控制器:如何angularjs单元测试
return Restangular
.extendModel('modelA', function(model) {
model.functionA = function(body) {
return this.customPUT(body, 'add')
};
return model;
})
.service('accounts');
我还可以ControllerB使用它,它工作得很好。
function functionB(body){
instanceModelB.instanceModelA.functionA(body)
.then(onSuccess)
.catch(onFail)
.finally(onFinally);
}
但是如何在ControllerB的单元测试中使用它?我的意思是如何在ControllerB的单元测试中调用functionA?它总是说'功能A不是功能'。 在此先感谢。