javascript - Angular2 - Class constructor cannot be invoked without 'new' -


i'm trying integrate angular2-odata library. i'm using

    @injectable()     class myodataconfig extends odataconfiguration{         baseurl="http://localhost:54872/odata/";     }      bootstrap(app,[         //some of other providers etc.         provide(odataconfiguration, {useclass:myodataconfig}),         odataservicefactory,     ] 

problem when try inject odataservicefactory following error:

exception: error during instantiation of odataconfiguration! (classservice -> odataservicefactory -> odataconfiguration). original exception: typeerror: class constructor odataconfiguration cannot invoked without 'new'

i googled , seems there problem while trying inject extended class, not able find solution this. appreciated.

a temporary workaround use new on odataconfiguration class , override baseurl :

@component({     templateurl: './categorygridodata.component.html',     selector: 'my-category-grid-odata',     providers: [ { provide: odataconfiguration, usefactory: () => {         let odta = new odataconfiguration();         odta.baseurl = 'http://services.odata.org/v4/northwind/northwind.svc';         return odta; }     }, odataservicefactory ],     styleurls: [ './cargrid.component.css'] }) export class categorygridodatacomponent { 

for complete code see : https://github.com/stefh/angular2-webpack-starter/blob/_stef_dev/src/app/car/categorygridodata.component.ts#l18

for more details see : https://github.com/gallayl/angular2-odata/issues/3


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -