I think this is not "toggle" situation, because how can you click something once it's invisible?
Anyway, you can make every <li>
as component and than every visible
will be in a different scope.
Another way, you can add to item
object a property, for example visible
and then every click will change the value as you want.
For example:
<ul *ngFor="let item of items">
<li *ngIf="item.visible" (click)="item.visible = false">{{item.text}}</li>
</ul>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…