Normally checked just add at the end of input
<input type="radio" name="item" value="value1" checked> <input type="radio" name="item" value="value2">
But now I am using * ngFor. I want to choose the first one.
I am trying to do this, but this does not work because checked not a class.
<div *ngFor="#item of collection; #i = index""> <input type="radio" name="item" value="{{item}}" [ngClass]="{'checked':i === 0}"> <label>{{item}}</label> </div>
So how can I do this? Thanks!
source share