我想通过Angular2 Typescript进行身份验证,但它无法正常工作,因为它在浏览器中询问我。我的代码怎么了?
callrest(){
let url="/edison";
return this.http.post(url, this.getPutHeaders()).map(res => res.json()).subscribe(
data => console.log(data),
err => console.log(err)
);;
}
private getPutHeaders(){
let headers = new Headers();
headers.append('Content-Type', 'text/plain');
headers.append('Authorization', 'Basic ' +
btoa('user:pw'));
return new RequestOptions({
headers: headers
});
}