i am assigning an array to a key which need to be send in the payload of POST call in my angular js application. for example like below.
this.selectedCtlIds =[877, 982, 091, 112];
function saveFormSettings() {
let data = this.settings; // have various key from the GET call
data.statusIdToBeChanged = this.selectedCtlIds;
console.log(data.statusIdToBeChanged, 'test '); // works fine
Service.updateSettings(data).then(function (resp) {
//POST CALL HERE
}
}
function updateSettings(param) {
return $http({
method: 'POST',
url: url + '/setting',
params: param
})
}
expected payload by api is like statusIdToBeChanged: [877, 982, 091, 112]
instead it is passed like below when i checked in network payload
statusIdToBeChanged[]: 284
statusIdToBeChanged[]: 982
statusIdToBeChanged[]: 091
statusIdToBeChanged[]: 112
due to which the api is failing. i am not sure why it is like this in payload.
Service.updateSettingsand yourupdate call`${param}`