我有一个API.如果您打开,则应输入用户名和密码.如何获取该API中的数据?如果我写get("....api-url...."),它显示unauthorized error.如何将用户名和密码传递给该API?
constructor(private _http: Http) {
this.getMyBlog();
}
private getMyBlog() {
return this._http.get('http://localhost:8088/.../...')
.map((res: Response) => res.json())
.subscribe(data => {
this.data = data;
console.log(this.data);
});
}
Run Code Online (Sandbox Code Playgroud) angular ×1