DEV Community

Discussion on: Testing Loading States using RxJS operators

Collapse
 
rompetomp profile image
Hannes Vermeire

Hi Jennifer, great post. Wouldn't this call the Observable twice though?

    <div class="pending" *ngIf="(cats | async)?.isLoading; else loaded"></div>
    <ng-container #loaded>
        <div class="cat" *ngFor="let cat of (cats | async)?.value">
        <p>Name: {{cat.name}}</p>
        </div>
    </ng-container>

Once for the *ngIf and another time for the *ngFor?