how to show loading indicator on page loading in angular 7 until all apis response?How to show loading...

Was there a Viking Exchange as well as a Columbian one?

What is the relationship between spectral sequences and obstruction theory?

What language was spoken in East Asia before Proto-Turkic?

Was there a shared-world project before "Thieves World"?

Mac Pro install disk keeps ejecting itself

What is the most expensive material in the world that could be used to create Pun-Pun's lute?

How exactly does Hawking radiation decrease the mass of black holes?

How come there are so many candidates for the 2020 Democratic party presidential nomination?

Why was the Spitfire's elliptical wing almost uncopied by other aircraft of World War 2?

Is there any limitation with Arduino Nano serial communication distance?

Why do games have consumables?

What is the difference between `command a[bc]d` and `command `a{b,c}d`

Is there really no use for MD5 anymore?

Sci fi novel series with instant travel between planets through gates. A river runs through the gates

How to make a pipeline wait for end-of-file or stop after an error?

How to verbalise code in Mathematica?

Fizzy, soft, pop and still drinks

Pass By Reference VS Pass by Value

Unexpected email from Yorkshire Bank

US visa is under administrative processing, I need the passport back ASAP

Apply MapThread to all but one variable

French for 'It must be my imagination'?

What makes accurate emulation of old systems a difficult task?

Rivers without rain



how to show loading indicator on page loading in angular 7 until all apis response?


How to show loading spinner in jQuery?Google Maps API v3: How to remove all markers?How to show Page Loading div until the page has finished loadingRedirect to html pages based on a response from rest apiAngular4 delay template loading until API response is receivedHttpClient post with no return data throws errorAngular guard canActivate method dont work with Observable<boolean>Angular 7 - Loading data in chunks slows down the pageShow loading indicator in Angular while waiting for a RxJS observableAngular 7 - How to show loader until *ngFor loads the data?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







5















I have 5 api calls in a page. some apis take 20 sec to give response. some take 30 sec to give response. some take 10 sec so, when first api gives its response, first api sets loading indicator false. then loading indicator disppears. But other apis are still working I want to show loading indicator until the five api calls response. can you please give me some idea to do the task.



code:



component.ts



  loading = true;
ngInit() {

this.api1();
this.api2();
this.api3();
this.api4();
this.api5();

}

api1(){
this.loading=true;
this.apiService.api1.subscribe(response => {
loading = false;
}, error=>{

});
}
api2(){
this.loading=true;
this.apiService.api2.subscribe(response => {
loading = false;
}, error=>{

});

}
api3(){
this.loading=true;
this.apiService.api3.subscribe(response => {
loading = false;
}, error=>{

});
}
api4() {
this.loading=true;
this.apiService.api4.subscribe(response => {
loading = false;
}, error=>{

});
}
api5() {
this.loading=true;
this.apiService.api5.subscribe(response => {
loading = false;
}, error=>{

});
}


ApiService.service.ts:



     api1(): any {

return this.http.get('apiurl');

}
api2(): any {

return this.http.get('apiurl');

}
api3(): any {

return this.http.get('apiurl');

}
api4(): any {

return this.http.get('apiurl');

}

api5(): any {

return this.http.get('apiurl');

}









share|improve this question























  • You might want to check out the operator decision tree-app in the docs: rxjs-dev.firebaseapp.com/operator-decision-tree

    – PatrikAkerstrand
    17 hours ago


















5















I have 5 api calls in a page. some apis take 20 sec to give response. some take 30 sec to give response. some take 10 sec so, when first api gives its response, first api sets loading indicator false. then loading indicator disppears. But other apis are still working I want to show loading indicator until the five api calls response. can you please give me some idea to do the task.



code:



component.ts



  loading = true;
ngInit() {

this.api1();
this.api2();
this.api3();
this.api4();
this.api5();

}

api1(){
this.loading=true;
this.apiService.api1.subscribe(response => {
loading = false;
}, error=>{

});
}
api2(){
this.loading=true;
this.apiService.api2.subscribe(response => {
loading = false;
}, error=>{

});

}
api3(){
this.loading=true;
this.apiService.api3.subscribe(response => {
loading = false;
}, error=>{

});
}
api4() {
this.loading=true;
this.apiService.api4.subscribe(response => {
loading = false;
}, error=>{

});
}
api5() {
this.loading=true;
this.apiService.api5.subscribe(response => {
loading = false;
}, error=>{

});
}


ApiService.service.ts:



     api1(): any {

return this.http.get('apiurl');

}
api2(): any {

return this.http.get('apiurl');

}
api3(): any {

return this.http.get('apiurl');

}
api4(): any {

return this.http.get('apiurl');

}

api5(): any {

return this.http.get('apiurl');

}









share|improve this question























  • You might want to check out the operator decision tree-app in the docs: rxjs-dev.firebaseapp.com/operator-decision-tree

    – PatrikAkerstrand
    17 hours ago














5












5








5


4






I have 5 api calls in a page. some apis take 20 sec to give response. some take 30 sec to give response. some take 10 sec so, when first api gives its response, first api sets loading indicator false. then loading indicator disppears. But other apis are still working I want to show loading indicator until the five api calls response. can you please give me some idea to do the task.



code:



component.ts



  loading = true;
ngInit() {

this.api1();
this.api2();
this.api3();
this.api4();
this.api5();

}

api1(){
this.loading=true;
this.apiService.api1.subscribe(response => {
loading = false;
}, error=>{

});
}
api2(){
this.loading=true;
this.apiService.api2.subscribe(response => {
loading = false;
}, error=>{

});

}
api3(){
this.loading=true;
this.apiService.api3.subscribe(response => {
loading = false;
}, error=>{

});
}
api4() {
this.loading=true;
this.apiService.api4.subscribe(response => {
loading = false;
}, error=>{

});
}
api5() {
this.loading=true;
this.apiService.api5.subscribe(response => {
loading = false;
}, error=>{

});
}


ApiService.service.ts:



     api1(): any {

return this.http.get('apiurl');

}
api2(): any {

return this.http.get('apiurl');

}
api3(): any {

return this.http.get('apiurl');

}
api4(): any {

return this.http.get('apiurl');

}

api5(): any {

return this.http.get('apiurl');

}









share|improve this question














I have 5 api calls in a page. some apis take 20 sec to give response. some take 30 sec to give response. some take 10 sec so, when first api gives its response, first api sets loading indicator false. then loading indicator disppears. But other apis are still working I want to show loading indicator until the five api calls response. can you please give me some idea to do the task.



code:



component.ts



  loading = true;
ngInit() {

this.api1();
this.api2();
this.api3();
this.api4();
this.api5();

}

api1(){
this.loading=true;
this.apiService.api1.subscribe(response => {
loading = false;
}, error=>{

});
}
api2(){
this.loading=true;
this.apiService.api2.subscribe(response => {
loading = false;
}, error=>{

});

}
api3(){
this.loading=true;
this.apiService.api3.subscribe(response => {
loading = false;
}, error=>{

});
}
api4() {
this.loading=true;
this.apiService.api4.subscribe(response => {
loading = false;
}, error=>{

});
}
api5() {
this.loading=true;
this.apiService.api5.subscribe(response => {
loading = false;
}, error=>{

});
}


ApiService.service.ts:



     api1(): any {

return this.http.get('apiurl');

}
api2(): any {

return this.http.get('apiurl');

}
api3(): any {

return this.http.get('apiurl');

}
api4(): any {

return this.http.get('apiurl');

}

api5(): any {

return this.http.get('apiurl');

}






javascript jquery angular css3 angular7






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 17 hours ago









Kumaresan PerumalKumaresan Perumal

1,1241218




1,1241218













  • You might want to check out the operator decision tree-app in the docs: rxjs-dev.firebaseapp.com/operator-decision-tree

    – PatrikAkerstrand
    17 hours ago



















  • You might want to check out the operator decision tree-app in the docs: rxjs-dev.firebaseapp.com/operator-decision-tree

    – PatrikAkerstrand
    17 hours ago

















You might want to check out the operator decision tree-app in the docs: rxjs-dev.firebaseapp.com/operator-decision-tree

– PatrikAkerstrand
17 hours ago





You might want to check out the operator decision tree-app in the docs: rxjs-dev.firebaseapp.com/operator-decision-tree

– PatrikAkerstrand
17 hours ago












3 Answers
3






active

oldest

votes


















7














You can use rxjs forkjoin for the same. Forkjoin waits for all the request is complete and return the response when all the api call complete. Here is the example.



**component.ts**

isLoading: boolean;
constructor(private apiCallService: ApiSErvice) {}
ngOnInit() {
this.isLoading = true;
this.apiCallService.multipleApiCallFunction().subscribe(response => {
this.isLoading = false;
})
}


**ApiService.service.ts**

import { Observable, forkJoin } from 'rxjs';

multipleApiCallFunction() : Observable<any[]>{
const api1 = this.http.get('apiurl-1');
const api2 = this.http.get('apiurl-2');
const api3 = this.http.get('apiurl-3');
const api4 = this.http.get('apiurl-4');

return forkJoin([api1, api2, api3, api4]);

}






share|improve this answer


























  • We just did the same last week, nice one

    – Patrik Alexits
    17 hours ago











  • this is the correct way to do this (i'd place the loading's true inside a tap operator and the false inside a finalize block for readability)

    – Stavm
    17 hours ago













  • @Patrik Alexits thanks :)

    – Yash Rami
    17 hours ago











  • @Yash Rami guys thanks for the solution. can i use interceptor this ?

    – Kumaresan Perumal
    17 hours ago













  • @Kumaresan Perumal Sir, Interceptor is used for intercepting the request or response but here we have multiple api call so we did't track which api call is complete and which are pending so here we use fork join for the same

    – Yash Rami
    17 hours ago



















0














Another way to achieve this if you don't want to use forkJoin or want to control each one individually, you can create a Subscription variable for each API call, and then in your HTML use an *ngIf="sub1 || sub2 || ... || sub5" to display and hide the loading indicator, it will be something like this:



//declare subscriptions like so
sub1: Subscription;

ngInit() {
sub1 = this.api1();
sub2 = this.api2();
sub3 = this.api3();
sub4 = this.api4();
sub5 = this.api5();
}


in your HTML loading bar tag add:



*ngIf="sub1 || sub2 || sub3 || sub4 || sub5"





share|improve this answer
























  • html code is common for all components. so it is not fesible solution. please tell me any other idea.

    – Kumaresan Perumal
    16 hours ago











  • This isn't indicated in your question, and I still don't see why it isn't feasible. What do you mean by 'html code is common for all components'.

    – Ala
    16 hours ago











  • assume I have another component. That has five api calls , what will you do ?

    – Kumaresan Perumal
    16 hours ago











  • To my knowledge, you can still do the same :)

    – Ala
    16 hours ago











  • the html is your component's, if u want a variable like your loading boolean, you can check your other sub variables in the subscribe of each api call, if the rest are all null, that means they are finished and u can set the loading boolean to false :)

    – Ala
    16 hours ago





















0














You can simply use a variable(s) to store API results then load the content based on it's existance:



<div *ngIf = "apiResults; else elseBlock">
...
</div>
<ng-template #elseBlock>Loading...</ng-template>





share|improve this answer
























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55878352%2fhow-to-show-loading-indicator-on-page-loading-in-angular-7-until-all-apis-respon%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    7














    You can use rxjs forkjoin for the same. Forkjoin waits for all the request is complete and return the response when all the api call complete. Here is the example.



    **component.ts**

    isLoading: boolean;
    constructor(private apiCallService: ApiSErvice) {}
    ngOnInit() {
    this.isLoading = true;
    this.apiCallService.multipleApiCallFunction().subscribe(response => {
    this.isLoading = false;
    })
    }


    **ApiService.service.ts**

    import { Observable, forkJoin } from 'rxjs';

    multipleApiCallFunction() : Observable<any[]>{
    const api1 = this.http.get('apiurl-1');
    const api2 = this.http.get('apiurl-2');
    const api3 = this.http.get('apiurl-3');
    const api4 = this.http.get('apiurl-4');

    return forkJoin([api1, api2, api3, api4]);

    }






    share|improve this answer


























    • We just did the same last week, nice one

      – Patrik Alexits
      17 hours ago











    • this is the correct way to do this (i'd place the loading's true inside a tap operator and the false inside a finalize block for readability)

      – Stavm
      17 hours ago













    • @Patrik Alexits thanks :)

      – Yash Rami
      17 hours ago











    • @Yash Rami guys thanks for the solution. can i use interceptor this ?

      – Kumaresan Perumal
      17 hours ago













    • @Kumaresan Perumal Sir, Interceptor is used for intercepting the request or response but here we have multiple api call so we did't track which api call is complete and which are pending so here we use fork join for the same

      – Yash Rami
      17 hours ago
















    7














    You can use rxjs forkjoin for the same. Forkjoin waits for all the request is complete and return the response when all the api call complete. Here is the example.



    **component.ts**

    isLoading: boolean;
    constructor(private apiCallService: ApiSErvice) {}
    ngOnInit() {
    this.isLoading = true;
    this.apiCallService.multipleApiCallFunction().subscribe(response => {
    this.isLoading = false;
    })
    }


    **ApiService.service.ts**

    import { Observable, forkJoin } from 'rxjs';

    multipleApiCallFunction() : Observable<any[]>{
    const api1 = this.http.get('apiurl-1');
    const api2 = this.http.get('apiurl-2');
    const api3 = this.http.get('apiurl-3');
    const api4 = this.http.get('apiurl-4');

    return forkJoin([api1, api2, api3, api4]);

    }






    share|improve this answer


























    • We just did the same last week, nice one

      – Patrik Alexits
      17 hours ago











    • this is the correct way to do this (i'd place the loading's true inside a tap operator and the false inside a finalize block for readability)

      – Stavm
      17 hours ago













    • @Patrik Alexits thanks :)

      – Yash Rami
      17 hours ago











    • @Yash Rami guys thanks for the solution. can i use interceptor this ?

      – Kumaresan Perumal
      17 hours ago













    • @Kumaresan Perumal Sir, Interceptor is used for intercepting the request or response but here we have multiple api call so we did't track which api call is complete and which are pending so here we use fork join for the same

      – Yash Rami
      17 hours ago














    7












    7








    7







    You can use rxjs forkjoin for the same. Forkjoin waits for all the request is complete and return the response when all the api call complete. Here is the example.



    **component.ts**

    isLoading: boolean;
    constructor(private apiCallService: ApiSErvice) {}
    ngOnInit() {
    this.isLoading = true;
    this.apiCallService.multipleApiCallFunction().subscribe(response => {
    this.isLoading = false;
    })
    }


    **ApiService.service.ts**

    import { Observable, forkJoin } from 'rxjs';

    multipleApiCallFunction() : Observable<any[]>{
    const api1 = this.http.get('apiurl-1');
    const api2 = this.http.get('apiurl-2');
    const api3 = this.http.get('apiurl-3');
    const api4 = this.http.get('apiurl-4');

    return forkJoin([api1, api2, api3, api4]);

    }






    share|improve this answer















    You can use rxjs forkjoin for the same. Forkjoin waits for all the request is complete and return the response when all the api call complete. Here is the example.



    **component.ts**

    isLoading: boolean;
    constructor(private apiCallService: ApiSErvice) {}
    ngOnInit() {
    this.isLoading = true;
    this.apiCallService.multipleApiCallFunction().subscribe(response => {
    this.isLoading = false;
    })
    }


    **ApiService.service.ts**

    import { Observable, forkJoin } from 'rxjs';

    multipleApiCallFunction() : Observable<any[]>{
    const api1 = this.http.get('apiurl-1');
    const api2 = this.http.get('apiurl-2');
    const api3 = this.http.get('apiurl-3');
    const api4 = this.http.get('apiurl-4');

    return forkJoin([api1, api2, api3, api4]);

    }







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited 17 hours ago

























    answered 17 hours ago









    Yash RamiYash Rami

    53139




    53139













    • We just did the same last week, nice one

      – Patrik Alexits
      17 hours ago











    • this is the correct way to do this (i'd place the loading's true inside a tap operator and the false inside a finalize block for readability)

      – Stavm
      17 hours ago













    • @Patrik Alexits thanks :)

      – Yash Rami
      17 hours ago











    • @Yash Rami guys thanks for the solution. can i use interceptor this ?

      – Kumaresan Perumal
      17 hours ago













    • @Kumaresan Perumal Sir, Interceptor is used for intercepting the request or response but here we have multiple api call so we did't track which api call is complete and which are pending so here we use fork join for the same

      – Yash Rami
      17 hours ago



















    • We just did the same last week, nice one

      – Patrik Alexits
      17 hours ago











    • this is the correct way to do this (i'd place the loading's true inside a tap operator and the false inside a finalize block for readability)

      – Stavm
      17 hours ago













    • @Patrik Alexits thanks :)

      – Yash Rami
      17 hours ago











    • @Yash Rami guys thanks for the solution. can i use interceptor this ?

      – Kumaresan Perumal
      17 hours ago













    • @Kumaresan Perumal Sir, Interceptor is used for intercepting the request or response but here we have multiple api call so we did't track which api call is complete and which are pending so here we use fork join for the same

      – Yash Rami
      17 hours ago

















    We just did the same last week, nice one

    – Patrik Alexits
    17 hours ago





    We just did the same last week, nice one

    – Patrik Alexits
    17 hours ago













    this is the correct way to do this (i'd place the loading's true inside a tap operator and the false inside a finalize block for readability)

    – Stavm
    17 hours ago







    this is the correct way to do this (i'd place the loading's true inside a tap operator and the false inside a finalize block for readability)

    – Stavm
    17 hours ago















    @Patrik Alexits thanks :)

    – Yash Rami
    17 hours ago





    @Patrik Alexits thanks :)

    – Yash Rami
    17 hours ago













    @Yash Rami guys thanks for the solution. can i use interceptor this ?

    – Kumaresan Perumal
    17 hours ago







    @Yash Rami guys thanks for the solution. can i use interceptor this ?

    – Kumaresan Perumal
    17 hours ago















    @Kumaresan Perumal Sir, Interceptor is used for intercepting the request or response but here we have multiple api call so we did't track which api call is complete and which are pending so here we use fork join for the same

    – Yash Rami
    17 hours ago





    @Kumaresan Perumal Sir, Interceptor is used for intercepting the request or response but here we have multiple api call so we did't track which api call is complete and which are pending so here we use fork join for the same

    – Yash Rami
    17 hours ago













    0














    Another way to achieve this if you don't want to use forkJoin or want to control each one individually, you can create a Subscription variable for each API call, and then in your HTML use an *ngIf="sub1 || sub2 || ... || sub5" to display and hide the loading indicator, it will be something like this:



    //declare subscriptions like so
    sub1: Subscription;

    ngInit() {
    sub1 = this.api1();
    sub2 = this.api2();
    sub3 = this.api3();
    sub4 = this.api4();
    sub5 = this.api5();
    }


    in your HTML loading bar tag add:



    *ngIf="sub1 || sub2 || sub3 || sub4 || sub5"





    share|improve this answer
























    • html code is common for all components. so it is not fesible solution. please tell me any other idea.

      – Kumaresan Perumal
      16 hours ago











    • This isn't indicated in your question, and I still don't see why it isn't feasible. What do you mean by 'html code is common for all components'.

      – Ala
      16 hours ago











    • assume I have another component. That has five api calls , what will you do ?

      – Kumaresan Perumal
      16 hours ago











    • To my knowledge, you can still do the same :)

      – Ala
      16 hours ago











    • the html is your component's, if u want a variable like your loading boolean, you can check your other sub variables in the subscribe of each api call, if the rest are all null, that means they are finished and u can set the loading boolean to false :)

      – Ala
      16 hours ago


















    0














    Another way to achieve this if you don't want to use forkJoin or want to control each one individually, you can create a Subscription variable for each API call, and then in your HTML use an *ngIf="sub1 || sub2 || ... || sub5" to display and hide the loading indicator, it will be something like this:



    //declare subscriptions like so
    sub1: Subscription;

    ngInit() {
    sub1 = this.api1();
    sub2 = this.api2();
    sub3 = this.api3();
    sub4 = this.api4();
    sub5 = this.api5();
    }


    in your HTML loading bar tag add:



    *ngIf="sub1 || sub2 || sub3 || sub4 || sub5"





    share|improve this answer
























    • html code is common for all components. so it is not fesible solution. please tell me any other idea.

      – Kumaresan Perumal
      16 hours ago











    • This isn't indicated in your question, and I still don't see why it isn't feasible. What do you mean by 'html code is common for all components'.

      – Ala
      16 hours ago











    • assume I have another component. That has five api calls , what will you do ?

      – Kumaresan Perumal
      16 hours ago











    • To my knowledge, you can still do the same :)

      – Ala
      16 hours ago











    • the html is your component's, if u want a variable like your loading boolean, you can check your other sub variables in the subscribe of each api call, if the rest are all null, that means they are finished and u can set the loading boolean to false :)

      – Ala
      16 hours ago
















    0












    0








    0







    Another way to achieve this if you don't want to use forkJoin or want to control each one individually, you can create a Subscription variable for each API call, and then in your HTML use an *ngIf="sub1 || sub2 || ... || sub5" to display and hide the loading indicator, it will be something like this:



    //declare subscriptions like so
    sub1: Subscription;

    ngInit() {
    sub1 = this.api1();
    sub2 = this.api2();
    sub3 = this.api3();
    sub4 = this.api4();
    sub5 = this.api5();
    }


    in your HTML loading bar tag add:



    *ngIf="sub1 || sub2 || sub3 || sub4 || sub5"





    share|improve this answer













    Another way to achieve this if you don't want to use forkJoin or want to control each one individually, you can create a Subscription variable for each API call, and then in your HTML use an *ngIf="sub1 || sub2 || ... || sub5" to display and hide the loading indicator, it will be something like this:



    //declare subscriptions like so
    sub1: Subscription;

    ngInit() {
    sub1 = this.api1();
    sub2 = this.api2();
    sub3 = this.api3();
    sub4 = this.api4();
    sub5 = this.api5();
    }


    in your HTML loading bar tag add:



    *ngIf="sub1 || sub2 || sub3 || sub4 || sub5"






    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered 16 hours ago









    AlaAla

    307112




    307112













    • html code is common for all components. so it is not fesible solution. please tell me any other idea.

      – Kumaresan Perumal
      16 hours ago











    • This isn't indicated in your question, and I still don't see why it isn't feasible. What do you mean by 'html code is common for all components'.

      – Ala
      16 hours ago











    • assume I have another component. That has five api calls , what will you do ?

      – Kumaresan Perumal
      16 hours ago











    • To my knowledge, you can still do the same :)

      – Ala
      16 hours ago











    • the html is your component's, if u want a variable like your loading boolean, you can check your other sub variables in the subscribe of each api call, if the rest are all null, that means they are finished and u can set the loading boolean to false :)

      – Ala
      16 hours ago





















    • html code is common for all components. so it is not fesible solution. please tell me any other idea.

      – Kumaresan Perumal
      16 hours ago











    • This isn't indicated in your question, and I still don't see why it isn't feasible. What do you mean by 'html code is common for all components'.

      – Ala
      16 hours ago











    • assume I have another component. That has five api calls , what will you do ?

      – Kumaresan Perumal
      16 hours ago











    • To my knowledge, you can still do the same :)

      – Ala
      16 hours ago











    • the html is your component's, if u want a variable like your loading boolean, you can check your other sub variables in the subscribe of each api call, if the rest are all null, that means they are finished and u can set the loading boolean to false :)

      – Ala
      16 hours ago



















    html code is common for all components. so it is not fesible solution. please tell me any other idea.

    – Kumaresan Perumal
    16 hours ago





    html code is common for all components. so it is not fesible solution. please tell me any other idea.

    – Kumaresan Perumal
    16 hours ago













    This isn't indicated in your question, and I still don't see why it isn't feasible. What do you mean by 'html code is common for all components'.

    – Ala
    16 hours ago





    This isn't indicated in your question, and I still don't see why it isn't feasible. What do you mean by 'html code is common for all components'.

    – Ala
    16 hours ago













    assume I have another component. That has five api calls , what will you do ?

    – Kumaresan Perumal
    16 hours ago





    assume I have another component. That has five api calls , what will you do ?

    – Kumaresan Perumal
    16 hours ago













    To my knowledge, you can still do the same :)

    – Ala
    16 hours ago





    To my knowledge, you can still do the same :)

    – Ala
    16 hours ago













    the html is your component's, if u want a variable like your loading boolean, you can check your other sub variables in the subscribe of each api call, if the rest are all null, that means they are finished and u can set the loading boolean to false :)

    – Ala
    16 hours ago







    the html is your component's, if u want a variable like your loading boolean, you can check your other sub variables in the subscribe of each api call, if the rest are all null, that means they are finished and u can set the loading boolean to false :)

    – Ala
    16 hours ago













    0














    You can simply use a variable(s) to store API results then load the content based on it's existance:



    <div *ngIf = "apiResults; else elseBlock">
    ...
    </div>
    <ng-template #elseBlock>Loading...</ng-template>





    share|improve this answer




























      0














      You can simply use a variable(s) to store API results then load the content based on it's existance:



      <div *ngIf = "apiResults; else elseBlock">
      ...
      </div>
      <ng-template #elseBlock>Loading...</ng-template>





      share|improve this answer


























        0












        0








        0







        You can simply use a variable(s) to store API results then load the content based on it's existance:



        <div *ngIf = "apiResults; else elseBlock">
        ...
        </div>
        <ng-template #elseBlock>Loading...</ng-template>





        share|improve this answer













        You can simply use a variable(s) to store API results then load the content based on it's existance:



        <div *ngIf = "apiResults; else elseBlock">
        ...
        </div>
        <ng-template #elseBlock>Loading...</ng-template>






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 14 hours ago









        amithm7amithm7

        6816




        6816






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55878352%2fhow-to-show-loading-indicator-on-page-loading-in-angular-7-until-all-apis-respon%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Why do type traits not work with types in namespace scope?What are POD types in C++?Why can templates only be...

            Will tsunami waves travel forever if there was no land?Why do tsunami waves begin with the water flowing away...

            Simple Scan not detecting my scanner (Brother DCP-7055W)Brother MFC-L2700DW printer can print, can't...