我剛剛升級到Angular 2 RC 5
,並且出於某種原因,我無法弄清楚,我無法提出任何http請求(即,請求從未發出/不顯示在瀏覽器日誌中)。無法使用Angular 2進行http請求rc5
這是直到今天的升級工作的代碼。
console.log("Let's call github");
let url = 'https://raw.githubusercontent.com/angular/angular/master/LICENSE';
return this.get(url).do(d=>console.log('success'));
當我的組件調用包含此代碼的功能,Let's call github
被輸出,但隨後的請求沒有被製成。我確信@angular/http
的Observable
和Http
是正確導入的,因爲這個代碼今天早上工作。我首先想到的是,我是錯過了HttpModule
,但我已經證實,我將其導入到我的主要AppModule
事實上,如果我註釋掉HttpModule
進口,這都沒有區別,我可以看到。誤差是相同的,如下所示:
Exception: TypeError: this._body is null