我的问题是thymeleaf与angularJS的整合.我有这个thymleaf页面:
我的AngularJS方法:
app.controller('ctrlsubcomment',function($scope,$http) {
$scope.newssubcomment = {
mainComment: { id : ""},comment: {text: ""}
};
$scope.addSubComment = function(commentId) {
$scope.newssubcomment.mainComment.id = commentId;
alert("helllo comment : "+commentId +" " + $scope.newssubcomment.mainComment.id);
};
}
我的代码不起作用.我有AngularJS语法错误:
“Error: Syntax Error: Token ‘{‘ is unexpected,expecting []] at column 17 of the expression [addSubComment([${newsComment.comment.id}])] starting at [{newsComment.comment.id}])].
最佳答案
我挖了所有互联网然后找到了解决方案.
th:attr="ng-click='addSubComment(\''+${newsComment.comment.id}+'\');'"
引用:
http://www.mattheye.com/passing-data-between-spring-mvc-and-angularjs/
原文链接:/spring/431917.html