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>
Or can this even be combined in one statement?
div
above. I therefore do not need to reintroduceuser
as a variable anywhere else, since I already have it. – Sammy*ngIf
for a value that I know for a fact exists, which is in this case the language observable. – Sammy