0
'use strict';
define([], function() {
function myController($scope) {
//Do something...
};
}
myController.inject = ['$scope'];
return myController;
對於上述控制器,我無法調用myController。請參閱下面的代碼(茉莉花)。
describe('myController', function() {
'use strict';
var controller, scope;
beforeEach(inject(function($rootScope, $controller) {
controller = $controller;
scope = $rootScope.$new();
}));
describe('sum', function() {
it('1 + 1 should equal 2', function() {
expect(scope.listingsBarController()).toBe(2);
});
});
});
它說不確定是不是一個函數(在評估scope.listingsBarController。
有什麼不對?