当我尝试运行时:
^ # match beginning of a line
#{list} # match the value of list
[^\n]*\n+ # match the rest of the line followed by all blank lines (if any)
(?:\s*\w+\s+\d+[^\n]*\n)* # match, in a non-capture group, >= 0 spaces, one
# word, > 0 spaces, > 0 digits, the rest of the line, repeatedly
# matching the non-capture group >= 0 times
\s* # match >= 0 spaces at beginning of next line
\K # forget everything matched so far
\w+ # match a word (what we want)
(?=\s+#{id})/ # in a positive lookahead, match > 0 spaces followed by the id
我在控制台中收到以下错误:
(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;
});
};
}
})();
我做错了什么。
答案 0 :(得分:1)
检查工厂employeeFactory的声明。
工厂存在,但似乎getEmployees不存在或者您没有将其声明为函数。
如果您需要一些帮助,请添加声明该工厂的代码
答案 1 :(得分:1)
您以错误的方式定义模块,
angular.module('myApp')
将其替换为
angular.module('myApp',[])