I have the following in my component template:
<div *ngIf="user$ | async as user>...</div>
Within the above div
I would like to use the async pipe to subscribe to another observable only once, and use it just like user
above throughout the template. So for instance, would something like this be possible:
<ng-template *ngIf="language$ | async as language>
<div *ngIf=" user$ | async as user>
<p>All template code that would use both {{user}} and {{language}} would go in between</p>
</div>
</ng-template>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…