2
我正在嘗試寫入全局角度$httpprovider
默認值爲TypeScript。這是我的代碼,我目前有。
export class JSONDateParser {
private httpProvider:any;
public static $inject = [
$httpProvider
];
constructor($httpProvider:any) {
console.log("Json Date Parser Defaults");
this.httpProvider = $httpProvider; // This gives me runtime error
// as this is a referencing angular.
}
}
// here is my reference registering this
app.config(JSONDateParser);
- 我怎麼能寫在打字稿angularjs
httpProvider
默認值? - 另外我怎樣才能應用lambda語法構造函數在Typescript中。
- 如果我將
httpProvider
變量指定爲ng.IHttpProvider
類型,編譯器投訴this.httpProvider.defaults.transformResponse
,transformResponse
未解決。我在angular.d.ts (1.2.x)的類型定義中看到它沒有被定義,但它應該在那裏嗎?我錯過了什麼嗎?
在此先感謝您的幫助。