我试图将标记为默认的radiobutton取决于我从我的对象获得的值,可以是True或False。 如何根据选项标记为默认单选按钮?Angular 4默认radioButton默认设置
<label>This rule is true if:</label>
<label class="form-check-inline">
<input class="form-check-input" type="radio" name="mode"
value="true" [(ngModel)]="rule.mode"> all the following conditions are true
</label>
<label class="form-check-inline">
<input class="form-check-input" type="radio" name="mode" value="false" [(ngModel)]="rule.mode"> at least one of the following conditions is true
</label>
我得到了真或假:“rule.mode”
[attr.checked] = “role.mode” –
@BharatChauhan这是一个正确的答案,完美的 '初始化只' 设置的值。谢谢! – CularBytes