【发布时间】:2020-05-30 13:58:29
【问题描述】:
我正在尝试登录系统。在角度 1 中,有一些方法可以设置
withCredentials:true
但我在 angular2 中找不到可行的解决方案
export class LoginComponent {
constructor(public _router: Router, public http: Http, ) {
}
onSubmit(event,username,password) {
this.creds = {'Email': 'harikrishna@gmail.com','Password': '01010','RememberMe': true}
this.headers = new Headers();
this.headers.append('Content-Type', 'application/json');
this.http.post('http://xyz/api/Users/Login', {}, this.creds)
.subscribe(res => {
console.log(res.json().results);
});
}
}
【问题讨论】:
标签: javascript angular http