When using the AsyncPipe inside of an *ngIf, if the Observable connected to the AsyncPipe pushes its values before the *ngIf becomes true, the value returned from the AsyncPipe will be incorrect.
For example, let's say I have:
<div *ngIf="showPipe">
<div *ngFor="let item of arrObs | async">{{item}}</div>
</div>
Then say events happen in this order:
showPipeis falsearrObspushes [1,2,3]showPipeis set to true
From what I've seen, the *ngFor will act as if arrObs | async returned null.
One solution to this problem is to use [hidden] instead, but there are a lot of benefits to *ngIf, like performance and making null handling easier.
What's the proper way to do this? Should I just not use an observable at all for displaying content? I had assumed that using an observable was the most Angular-y way of doing things.
Edit:
My observable is actually just a new Subject() which I call next() on.