Instantiate service on startup in Angular2
You can provide a dummy APP_INITIALIZER
and pass it as dependency
like
@NgModule({
providers: [{provide: APP_INITIALIZER, useMulti: true, deps: [MyService], useFactory: (myService) => null}]
You can provide a dummy APP_INITIALIZER
and pass it as dependency
like
@NgModule({
providers: [{provide: APP_INITIALIZER, useMulti: true, deps: [MyService], useFactory: (myService) => null}]