【发布时间】:2016-04-25 19:47:17
【问题描述】:
我正在玩 angular 2,但在发送 http get 请求时遇到问题。 我创建了这样的方法:
test(){
console.log("call test");
let header = new Headers();
header.append("authorization",'change9ziKuJH8wnVbNES3AMleYGPKzZ');
this._http.get('http://localhost:42055/api/Question',{headers:header}).do(res => console.log("Result: " + JSON.stringify(res)));
}
主要问题是,这个 http 请求从未被发送。我查看 Fiddler 并没有对我的 localhost:42055 的请求。
不幸的是,Angular 没有显示任何错误,所以我不知道发生了什么。
【问题讨论】: