我打電話使用 方法的REST API是 「POST」 的RequestData是
{
'username': user.userName,
'password': user.password,
'deviceID': deviceid,
'latlng': null,
'pincode': null
}
var req = {
method: method,
url: 'http://url/' + Api,
headers: {
'Token': 'Basic bUY5VkV0eHBOK3JUYUF1TGJjM1FHRGh4N1hYejhYSEw=',
'Content-Type': 'application/json'
},
data: {
'contentType': 'application/json',
'content': requestData
},
}
console.log(req);
$http(req).then(successCallback, errorCallback);
我的REST API是
@RequestMapping(value = "/authenticateUser", method = RequestMethod.POST, consumes = "application/json")
public AuthenticateUserBean authenticateUser(@RequestBody final AuthenticateUserBean authenticateUserBean) {
我recieving所有數據的空值,如用戶名,密碼。 這是一個角js離子混合應用程序。 使用chrome調用它。 Cors已被禁用。
看到我的【答案】(http://stackoverflow.com/a/42852534/3543808)和後期的開發工具網絡標籤要求的截圖 –