Last active
August 3, 2023 11:55
-
-
Save haohanyang/82c38bfb78131cdbdf6cc5ae5439bf6f to your computer and use it in GitHub Desktop.
Fetch data in angular
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div *ngIf="fetchingError; else fetchingTemplate" class="alert alert-danger" role="alert"> | |
{{ fetchingError }} | |
</div> | |
<ng-template #fetchingTemplate> | |
<div class="spinner-border text-primary" *ngIf="fetching; else dataTemplate" role="status"> | |
<span class="visually-hidden">Loading...</span> | |
</div> | |
<ng-template #dataTemplate> | |
<div class="row"> | |
<app-word *ngFor="let word of words" [word]="word" class="col-md-6 col-lg-4 col-12 mb-2"></app-word> | |
</div> | |
</ng-template> | |
</ng-template> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment