目前來自Angular JS控制器,我試圖將JSON數據發送到後端服務。但是我有400個錯誤的請求錯誤。400(錯誤請求)錯誤
從控制器,我試圖通過像HTTP服務發送的數據:
shipDataJson.contractNumber=$scope.contractNumber;
shipDataJson.orderNumber=$scope.orderNumber;
shipDataJson.shipmentNumber=$scope.shipmentNumber;
shipDataJson.SCN=$scope.SCN;
shipDataJson.sourceSystem=$scope.selectedSrcSystem;
shipDataJson.destinationSystem=$scope.selectedDestSystem;
shipDataJson.resendFlag='false';
但實際上在發送時間JSON是這樣的:
{
"contractNumber": "abc",
"orderNumber": "der",
"shipmentNumber": "faas",
"SCN": "fsdafas",
"sourceSystem": {
"resendFlag": false,
"sourceSystem": "arnab"
},
"destinationSystem": {
"resendFlag": false,
"destinationSystem": "swar"
},
"resendFlag": "false"
}
不要有想法從JSON中刪除額外的「resendFlag」字段。
在此先感謝。
我覺得你的東西之前添加。你發佈的內容對我來說看起來是正確的。檢查某處添加了? –
嘗試控制檯:'$ scope.selectedSrcSystem'和'$ scope.selectedDestSystem'。可能在這裏只是問題。 –
你可以顯示這個對象包含什麼,「$ scope.selectedDestSystem」。還告訴我們你在哪裏真正分配該對象的值 – Vish