将参数从Spring Controller传递给javascript

时间:2015-07-16 10:59:13

标签: javascript java angularjs spring

我尝试将参数从spring控制器传递给javascript。 我收到错误错误:

[ng:areq] http://errors.angularjs.org/1.3.16/ng/areq?p0=mainController&p1=not%20aNaNunction%2C%20got%20undefined
    at Error (native)
    at http://localhost:8080/asreports/resources/js/angular.min.js:6:417
    at Sb (http://localhost:8080/asreports/resources/js/angular.min.js:19:510)
    at La (http://localhost:8080/asreports/resources/js/angular.min.js:20:78)
    at $get (http://localhost:8080/asreports/resources/js/angular.min.js:75:465)
    at compile (http://localhost:8080/asreports/resources/js/angular-ui-router.min.js:7:23333)
    at Xc (http://localhost:8080/asreports/resources/js/angular.min.js:70:279)
    at M (http://localhost:8080/asreports/resources/js/angular.min.js:59:323)
    at g (http://localhost:8080/asreports/resources/js/angular.min.js:51:409)
    at http://localhost:8080/asreports/resources/js/angular.min.js:51:17

如果我删除" $ {variable}"从控制器一切正常。

我的javascript



"use strict"

myapp.controllers = {};

myapp.controllers.main = ['$scope', '$state', function($scope, $state) {

	$scope.casedet = ${variable};

} ];

app.controller('mainController', myapp.controllers.main)




我的模特



model.addAttribute("variable", selectedCase);




0 个答案:

没有答案