第一種,直接傳遞數組json
var data = ["123","456"];
that.loadDictionarys(data).subscribe({ next: res => { }, error: err => { } });
@POST @Path("/loadDictionarys") @Produces({ MediaType.APPLICATION_JSON, FastJSONProvider.TEXT_JSON, FastJSONProvider.TEXT_FASTJSON }) public RestResponse loadDictionarys(String[] dicItemCodeArr) { Map<String, DictionaryVO> dictionaryVOs = new HashMap<>(); RestResponse successResult = RestResponse.successResult(dictionaryVOs); return successResult; }
第二種,經過json對象傳遞後端
var data = {
arr:["123","456"]
};
that.loadDictionarys(data).subscribe({ next: res => { }, error: err => { } });
@POST
@Path("/loadDictionarys") @Produces({ MediaType.APPLICATION_JSON, FastJSONProvider.TEXT_JSON, FastJSONProvider.TEXT_FASTJSON }) public RestResponse loadDictionarys(@FormParam("arr") List<String> arr) { Map<String, DictionaryVO> dictionaryVOs = new HashMap<>(); RestResponse successResult = RestResponse.successResult(dictionaryVOs); return successResult; }