angular - Injecting into existing constructor -
i'm having difficulties trying inject service in angular. i'm trying create service extending class existing constructor, follows:
@injectable() export class authhttpservice extends authhttp { constructor(options: authconfig, http: http, defopts?: requestoptions) { super(options, http, defopts); } }
my issue is: need inject service , can't seem put argument in constructor (can't put required argument after optional 1 , if put optional ? doesn't work).
i've tried injector.get
, works reasonably injects different instance of service other components , breaking app (i rely on service properties show information).
any solution? thanks!
to inject service, add constructor before optional parameter. fine.
@injectable() export class authhttpservice extends authhttp { constructor(options: authconfig, http: http, otherservice: otherservice, defopts?: requestoptions) { super(options, http, defopts); } }
Comments
Post a Comment