如何在角度4.0中默认设置单选按钮?

时间:2018-01-17 15:21:15

标签: angular

我目前正在使用angular 4.0。我有两个单选按钮,默认情况下如何设置一些单选按钮。

    <div class="row" style="margin-top: 5px;margin-left: 5px;">
         <input type="radio" value="timeShift" (click)="selectOption($event)" ngModel="mValue" > TIMESFTO & TIMESFT1
</div>
<div class="row" style="margin-top: 5px;margin-left: 5px;">
    <input type="radio" value="rsh" (click)="selectOption($event)" ngModel="mValue" checked="checked"> RSH1
</div>

2 个答案:

答案 0 :(得分:1)

默认情况下,您可以使用值属性进行检查。

using terms from application "Mail"
    on perform mail action with messages theMessages for rule theRule
        repeat with msg in theMessages
            set theText to subject of msg & return & content of msg & date sent of msg
            display dialog (theText)
        end repeat
    end perform mail action with messages
end using terms from

或者您需要使用布尔值true设置组件中变量timeShift / rsh的值。

答案 1 :(得分:0)

您可以使用[checked]制作单选按钮

<div class="row" style="margin-top: 5px;margin-left: 5px;">
    <input type="radio" [value]="'timeShift'"   > TIMESFTO & TIMESFT1
</div>
<div class="row" style="margin-top: 5px;margin-left: 5px;">
<input type="radio" [value]="'rsh'"   [checked]="true"> RSH1
</div>