When i write dynamic "for" attribute in label, i get error.
example:
<div *ngFor="let question of questions; let i = index;">
<input id="ques-{{i}}" type="radio" name="selected" [value]="question">
<label for="ques-{{i}}">{{question.data}}</label>
</div>
the error :
Unhandled Promise rejection: Template parse errors: Can't bind to 'for' since it isn't a known property of 'label'.
the dynamic "id" attribute working fine, please help me to find a solution
You have to access label's attribute like this: [attr.for]="'ques-' + i"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With