angularjs - Typescript writing angular $httpprovider defaults -


i trying write global angular $httpprovider defaults in typescript. here code, have currently.

export class jsondateparser {     private httpprovider:any;     public static $inject = [         $httpprovider     ];     constructor($httpprovider:any) {         console.log("json date parser defaults");         this.httpprovider = $httpprovider; // gives me runtime error                                             // referencing angular.     } }  // here reference registering app.config(jsondateparser); 
  1. how can write angularjs httpprovider defaults in typescript?
  2. also how can apply lambda syntax constructor in typescript.
  3. if assign httpprovider variable ng.ihttpprovider type, complier complains this.httpprovider.defaults.transformresponse, transformresponse not resolved. see in type definition angular.d.ts (1.2.x) not defined, should there right? missing something?

thanks in advance helping me out.

we need bit adjusted syntax:

// define parser export class jsondateparser {      constructor(private $httpprovider:any) {         console.log("json date parser defaults");     } }  // register app.config(['$httpprovider', ($httpprovider) => new jsondateparser($httpprovider)]); 

angular .config() not flexible .service() or .controller().

so have pass params controller inside of initialization arrow function. used array notation, way - later not suffer minifying

also, if delcare param private:

constructor(private $httpprovider:any) { ... 

compiler create field , assign later can this.$httpprovider


Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -