问题
I have an instruction like this:
<ng-container *ngIf="(someService.modules$ | async | filterByPurchased:true) as purchasedModules">
some generated content
<div *ngFor="let module of purchasedModules">{{module.name}}</div>
</ng-container>
But I also need to check if purchasedModules.length > 0. Unfortunately, purchasedModules is not a recognized variable in the instruction where the alias is created (so I can't just add && purchasedModules.length there), why? How to do it without another <ng-container> with another *ngIf?
来源:https://stackoverflow.com/questions/59421884/angular-template-use-as-generated-alias-in-the-same-instruction