Displaying an asycnhronous loader in angular

To display a loader while waiting for an AJAX call to be processed, use a template, and an *ngIf / else condition on a container.

Example, with ng zorro :

<ng-container *ngIf="!saving else loading">
Will be displayed once the "saving" variable is false.
</ng-container>

<ng-template #loading>
  <div nz-row nzJustify="center">
    <nz-spin nzSimple></nz-spin> Displayed as long as the "saving" variable is true ...
  </div>
</ng-template>

Leave a Reply

Your email address will not be published. Required fields are marked *