[英]Access local template variable using interpolation inside *ngIf, Angular 2
假设我有这种情况;
<div *ngFor="item of items; let i = index;">
<div *ngIf="variable{{i}}">show if variable{{i}} is true</div>
</div>
我已经定义了变量“variable0”,“variable1”,...如何使用* ngIf中的插值以这种方式访问变量? 我知道* ngIf是一个单独的模板,这就是为什么它看不到“i”变量,但是如何将它传递到* ngIf模板并使用它呢?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.