我打电话使用 方法的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)和后期的开发工具网络标签要求的截图 –