Angular版本 4.3.3
请求代码:
this.http.post(apiurl,
{
username:this.username,
password:this.password,
remember:(this.remember ? 1 : 0)
})
.subscribe(
(val) => {
console.log("POST call successful value returned in body",
val);
},
response => {
console.log("POST call in error", response);
},
() => {
console.log("The POST observable is now completed.");
});
控制台报错信息:
XMLHttpRequest cannot load http://172.16.0.10:8085/xapi/admin/login. Request header field Content-Type is not allowed by Access-Control-Allow-Headers in preflight response.
login.component.ts:129
POST call in error
请求相关信息:
同样的请求,在localhost中,用jquery的$ajax可以成功请求。
请教,是哪里出了问题呢?怎么破?
使用HttpParams解决了……
这……