It is possible to do this and code gets run when the module gets loaded:
import { NgModule } from '@angular /core';
@NgModule({...})
export class SomeNgModule {
constructor(providedService: ProvidedService) {
providerService.iCanDoThis('?');
}
}
But if i wanted to initialize code, should i not use APP_INITIALIZER
or some other hook?
I can't find a good reason for when this is a good use and how would it be helpful.
Probably another good question would be: When would this code be executed in Angular's application life-time?
Aucun commentaire:
Enregistrer un commentaire