我必须在angular2中登录。如果我按下登录,则会出现错误
并且在浏览器上调用链接http://localhost:3000/idx-kk/app_dev.php/de/signon之后我就变成了无法获取/idx-kk/app_dev.php/de/signon 我测试了我的后端和SOAPUI,并且工作正常。我错了什么?
我的login.service.ts是
login(username, password, tenant): Observable<boolean> {
let body = JSON.stringify({ user: username, password: password,tenant: tenant });
console.log(body);
return this.http.post("idx-kk/app_dev.php/de/signon", body)
.map((response: Response) => {
console.log(response);
});
}
和login.component.ts
login() {
this.loading = true;
this.loginService.login(this.model.username, this.model.password, this.model.tenant)
.subscribe(result => {
if (result === true) {
// login successful
this.router.navigate(['/']);
} else {
// login failed
this.error = 'Username or password is incorrect';
this.loading = false;
}
});
}