0
我有一個這樣的測試對象:
it('calls the stuFun method', function() {
$scope.stuFun();
expect($scope.stuFun).to
.have.been.calledOnce;
expect($scope.students.pay).to.not.equal(null);
assert.isNotTrue($scope.students.pay)
});
下面是我的控制器功能:
$scope.stuFun = function() {
$scope.students.pay = false;
};
爲什麼我收到下面的錯誤:
undefined is not an object (evaluating '$scope.students.pay')
你有一個想法如何嘲笑這種服務... http://stackoverflow.com/questions/38227705/undefined-is-not-an-object-in-angular-js-service – Shane