I have the following class ModuleWithHttp
:
@Injectable()
export default class {
constructor(private fetchApi: FetchApi) {}
}
and I want to use it as follows:
@Component({
selector: 'main',
providers: [FetchApi]
})
export default class extends ModuleWithHttp {
onInit() {
this.fetchApi.call();
}
}
So by extending a super class that already injects a dependency I want to have an access to it in its children.
I tried many different ways, even having super-class as a component:
@Component({
providers: [FetchApi]
})
export default class {
constructor(private fetchApi: FetchApi) {}
}
But still, this.fetchApi
is null
, even in super-class.