当我尝试运行此:AngularJs功能没有发现
(function() {
'use strict';
// 1. Module definieren
angular.module('myApp')
.controller('homeController',homeController);
homeController.$inject = ['employeeFactory'];
function homeController(employeeFactory) {
var vm = this;
vm.getEmployees = function() {
employeeFactory.getEmployees()
.then(function(employee) {
console.log(employee);
vm.employees = employee.result;
});
};
}
})();
我收到以下错误在我的控制台:
angular.js:13307 TypeError: employeeFactory.getEmployees is not a function
at homeController.vm.getEmployees (homeController.js:11)
at fn (eval at <anonymous> (angular.js:14157), <anonymous>:4:280)
at expensiveCheckFn (angular.js:15146)
at callback (angular.js:24614)
at Scope.$eval (angular.js:16888)
at Scope.$apply (angular.js:16988)
at HTMLButtonElement.<anonymous> (angular.js:24619)
at defaultHandlerWrapper (angular.js:3394)
at HTMLButtonElement.eventHandler (angular.js:3382)
我在做什么错。
你能包括替换它的工厂代码,而运行此代码? –
问题是'employeeFactory',没有代码,不能肯定有帮助 –