【发布时间】:2017-09-19 02:04:02
【问题描述】:
Api 在从高级客户端调用时运行良好,但当我通过 http 调用时,它无法按预期工作。这是因为它没有发送凭据。各位大侠帮帮我,这里怎么用withCredentials:true。
这是我的角度代码:
var headers = new Headers();
headers.append('Content-Type', 'application/x-www-form-urlencoded');
this.http.post('http://localhost/jiffy_fun/laravel/public/token',{headers: headers}).map(res => res.json()).subscribe(res => {this.token = res});
谢谢
【问题讨论】:
-
this.http.post的语法是否正确?我认为应该是$http而不是http。 -
@KhalidHussain
this.http.post在 angular2 中是正确的。$http来自角度 1。
标签: angular