当我从高级客户端rest调用Api时,它可以完美地工作,但当我通过http
调用时,它的表现并不如预期。这是因为它没有发送凭证。各位大侠,请帮忙告诉我如何在这里使用withCredentials:true
。
以下是我的angular代码:
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
。 - Khalid Hussainthis.http.post
是正确的。$http
是来自Angular 1的。 - TheKojuEffect