Hi I have created a function which need to be loaded before a component starts loading. For that I have used AppInitializer. If I want load one function, it works. But I need both. And ngOnInit() or *ngIf also won't work as I need this function before my component loads. Here is my app.service.ts
detail1: any;
detail2: any;
getDetail1() {
return this.detail1;
}
getDetail2() {
return this.detail2;
}
loadDetail1() {
return new Promise((resolve, reject) => {
this.http.get<any>(URL1)
.subscribe(detail1 => {
this.detail1 = detail1['respObj'];
resolve(true);
});
});
}
loadDetail2() {
return new Promise((resolve, reject) => {
this.http.get<any>(URL2)
.subscribe(detail2 => {
this.detail2 = detail2['respObj'];
resolve(true);
});
});
}
How do I implement it in a nested function on how do I call this function before app loads. Please let know if anyone has any idea.