在我的登录组件里面
this.authenticationService.login('user', 'password').subscribe(comments => {
alert('success');
});
在我的 AuthService 里面:
login(username: string, password: string) {
let headers = new Headers({ 'Content-Type': 'application/json' });
let options = new RequestOptions({ headers: headers });
let url = 'http://22.5.66.58/api/v1/Identity/Login';
console.log(this.data);
return this.http.post(url, this.data, options).map((res: Response) => res.json());
}