Когда я пытаюсь запустить это: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' и без кода, не может помочь –