Click here to Skip to main content
15,891,864 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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


can anyone plz help me, how to solve this issue.

Thanks
Posted
Updated 5-Apr-15 22:34pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900