I want to access the input element in the following ngIf for checking if it's currently having a specific value or not. The not working part here is the code inside the ngIf
.
<span *ngFor="let item of items;let i=index">
<input type="text" #[InputItem+i] value="{{item}}"/>
<div *ngIf="('InputItem'+i).value" >
I'm focused!
</div>
</span>
<span *ngFor="let item of items;let i=index">
<input type="text" value="{{item}}"/>
<div *ngIf="InputItem[i]" >
I'm focused!
</div>
Declare variable InputItem:[] as array
Try to declare InputItem as arry like InputItem[0] = false,InputItem[1] = false like wise and you can update the variable when you need based condition
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.