I am working on a angular Project with multiple modules. I am trying to show a loader on a load of each page and only hide the loader once the request for all the API call is completed for that page.
So, my problem won't be solved just by showing a loader right after onInit is called and hide it after all the request is completed.
suggest me a best option so i can show and hide loader on all api executed.
ngOnInit() {
this.function1();
this.function2();
this.function3();
}
function1(){
this.spinner.show();
// API code here..
this.spinner.hide();
}
function2(){
this.spinner.show();
// API code here..
this.spinner.hide();
}
function3(){
this.spinner.show();
// API code here..
this.spinner.hide();
}