I am getting parse error
Syntax Error: Token '{' is an unexpected token at column 8 of the expression [user= ${user}] starting at [{user}].
home.html
<body ng-controller="mainCtrl" ng-init="user= ${user}">
Referring this example ,I am sending model to angularjs Getting data from Spring MVC in Angular JS in the initial view call.
controller.js
angular.module('userSystem', [ 'ngRoute' ]).config(
function($routeProvider, $httpProvider) {
$routeProvider.when('/', {
templateUrl : 'home.html',
controller : 'home'
}).when('/login', {
templateUrl : 'login.html',
controller : 'navigation'
}).otherwise('/');
}).controller('mainCtrl',
function($rootScope, $scope, $http, $location, $route) {
})
});
Spring Controller
@RequestMapping(value = "/", method = RequestMethod.GET)
public String getIndex(Model model)
{
model.addAttribute("user","user");
return "home";
}
Please let me know what is wrong here and how to fix it. Thanks
mainCtrlas well?.controller('mainCtrl', ["$rootScope", "$scope", "$http", "$location", "$route", function($rootScope, $scope, $http, $location, $route) {}]);<- here I'm passing the names of the function dependencies in the array as preceeding elements.