0
我有這樣的代碼:如何發送2對象在angular2交請求
客戶端(angular2)
saveConfig(configType: ConfigTypes, gasConfigModel: GasConfigModel): any {
console.info("sending post request");
let headers = new Headers({
'Content-Type': 'application/json'
});
....
return this.http
.post(this.url, formParamString, ??, {headers: headers})
.map(res => res.json())
.subscribe(
data => {
console.info("next: ");
console.info(data)
},
err => console.error(err)
);
}
和
服務器側:
@Path("/SaveConfig")
@POST
@Consumes(MediaType.APPLICATION_JSON + ";charset=utf-8")
@Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
public void saveConfig(MyObj my object, CountryGasStationConfig countryGasStationConfig) throws Exception {....}
我知道如何發送一個對象在後,但我怎麼發送2對象在發佈請求?