我試圖將標記爲默認的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