I am new to Angular 2.
I have a list and iterate it and display as radio buttons as shown below. Now I want to set the check property if condition is TRUE. How to
You can use it like this
<input type="radio" name="optradio" [checked]="savedVal == currentRadioVal ? true : false" >
try this
<table *ngIf="optionList">
<tr *ngFor="let op of optionList; let i = index">
<td>
<input type="radio" name="optradio" [checked]=" (CONDITION HERE)">
<label>{{op.option_text}} </label>
<td>
</tr>
</table>
Online demo: https://embed.plnkr.co/jSht4Do3DzpoVQG2SAwl/
<input type="radio" name='{{prod.configurationItem}}' value = '{{prod.additionalCost}}' [checked] = "prod.isDefault == 'Y' ? true : false"> prod is object item