控制器不是一个功能,未定义! [英] controller is not a function, got undefined!
本文介绍了控制器不是一个功能,未定义!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
i有MVC应用程序,我正在使用AngularJs。
我将员工从模型存储到angularjs服务/工厂。
MyCode:
Hi guys,
i have MVC application, in which i'm using AngularJs.
i'm storing employees from model into the angularjs service/factory.
MyCode:
mainApp.factory('employeeService', function () {
return employees: @Html.Raw(Model);
}
);
mainApp.controller("employeeController", ['$scope', 'employeeService', function ($scope, employeeService) {
$scope.employees = employeeService.employees;
}
]);
错误:
Error:
Uncaught SyntaxError: Unexpected token :
angular.js:11607 Error: [ng:areq] Argument 'employeeController' is not a function, got undefined
http://errors.angularjs.org/1.3.13/ng/areq?p0=employeeController&p1=not%20a%20function%2C%20got%20undefined
at angular.js:63
at assertArg (angular.js:1580)
at assertArgFn (angular.js:1590)
at angular.js:8431
at angular.js:7599
at forEach (angular.js:331)
at nodeLinkFn (angular.js:7586)
at compositeLinkFn (angular.js:7078)
at publicLinkFn (angular.js:6957)
at angular.js:1450(anonymous function) @ angular.js:11607
任何人都可以帮助我,如何解决这个问题e。
谢谢
can anyone plz help me, how to solve this issue.
Thanks
推荐答案
scope','employeeService',function(
scope', 'employeeService', function (
scope,employeeService){
scope, employeeService) {
scope.employees = employeeService.employees;
}
]);
scope.employees = employeeService.employees; } ]);
错误:
Error:
Uncaught SyntaxError: Unexpected token :
angular.js:11607 Error: [ng:areq] Argument 'employeeController' is not a function, got undefined
http://errors.angularjs.org/1.3.13/ng/areq?p0=employeeController&p1=not%20a%20function%2C%20got%20undefined
at angular.js:63
at assertArg (angular.js:1580)
at assertArgFn (angular.js:1590)
at angular.js:8431
at angular.js:7599
at forEach (angular.js:331)
at nodeLinkFn (angular.js:7586)
at compositeLinkFn (angular.js:7078)
at publicLinkFn (angular.js:6957)
at angular.js:1450(anonymous function) @ angular.js:11607
任何人都可以帮助我,如何解决这个问题。
谢谢
can anyone plz help me, how to solve this issue.
Thanks
这篇关于控制器不是一个功能,未定义!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文