Answer the question
In order to leave comments, you need to log in
How to load data before starting the application?
I use this in a lazy load module:
{
provide: APP_INITIALIZER,
useFactory: appInit,
deps: [DocumentsSettings],
multi: true,
},
export function appInit(settings: DocumentsSettings) {
return () => settings.init();
}
@Injectable()
export class DocumentsSettings implements Settings {
private readonly url = `${environment.apiUrl}/documents`;
public init() {
return new Promise((resolve, reject) => {
alert();
resolve(true);
});
}
}
alert()
it is not displayed.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question