Ng4LoadingSpinner timeout after 5 sec

Viewed 1702

I am facing one problem while using Ng4LoadingSpinner. it is disappearing automatically after default timeout 5 seconds, but our request is still in progress. if we increase the timeout then it works fine. If there is another solution to cancel the default timeout rather than increasing the timeout, please suggest the solution.

<ng4-loading-spinner [threshold]="0" [timeout]="60000" [zIndex]="100000"> </ng4-loading-spinner>
1 Answers

Best way to fix is keep a high default timeout and manually show and hide your spinner

Add below line to your component constructor in which you want to use the loader:

private spinnerService: Ng4LoadingSpinnerService

When on submit or any function call show and spinner and after request is completed hide it:

    submit(){

    //show spinner
     this.spinnerService.show();

       //service call or any process
       this.serviceCall.get().subscribe((result)=>{
        if(result.success)
         {
           //hide spinner
           this.spinnerService.hide();
         }

        }

    }

Hope this will help.

Related