【发布时间】:2017-02-17 06:53:31
【问题描述】:
我想从 angular js 发送字符串列表,其中我的控制器编码为
@POST
@PATH("/postdata")
@MediaType.Apllication_JSON
public int postData(@PathParam("datalist") List<String> datalist){
return 0;
}
var myApp=Angular.module('App',[]);
myApp.controller('myCTRL',function($http,$scope){
$http({
method : 'POST',
hearders : {
'Content-Type' : 'application/json; charset=utf-8',
'Accept' : 'application/json'
},
param : <new code i want here for the corresponding rest controller>
})
});
请注意:字符串列表将来自一个 json 文件,我通过使用 $http 检索 json 文件并存储在 $scope 变量中完成了该部分。
我想将此 $scope 变量转换为列表并发送列表数据。
【问题讨论】: