0

Is there any way show 'Loading' text until data fetch from api. As of now it is showing no data to display

I gone through the documentation did not found anything

1

1 Answer 1

1

You can try something like below:

In .ts file:

isLoading = false;

doRequest() {
  isLoading = true;
  this.servis.doRequest()
    .pipe(finalize(() -> this.isLoading = false))
    .subscribe(data => {
     // do smth
     })
}

in .html

<div *ngIf="!isLoading; else loading">Your content</div>
<ng-template #loading>Loading...</ng-template>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.