【发布时间】:2019-01-08 15:44:48
【问题描述】:
login.ts
onLogin() {
let input = new FormData();
input.append('email','ajith@gmail.com')
input.append('password','12356789')
this.http.post('http://worthyconsultants.in/training/api/v1/user/login',
input,{responseType: 'json'}).subscribe(res=>{
console.log(res)
},
err=>{
console.log(err)
})
}
【问题讨论】:
-
您确定响应类型是 JSON 吗?它看起来像一个php数组
-
@AndreiDumitrescu-Tudor 是的,添加了邮递员回复
-
你也可以在邮递员中显示响应头吗?
-
响应不是 JSON。试试这个标题
{ 'Content-Type':'application/json'} -
@AndreiDumitrescu-Tudor 添加