1
只需在Angular中設置一個默認的選定值,但到目前爲止我沒有運氣。使用ng-init默認選定的值不起作用
HTML編譯之前:
<select ng-options="select.Value as select.Name for select in ruleSelect" ng-model="rule.MatchLogic" ng-init="rule.MatchLogic = 0" ></select>
HTML在瀏覽器中來源:
<select ng-options="select.Value as select.Name for select in ruleSelect" ng-model="rule.MatchLogic" class="ng-pristine ng-valid">
<option value="?" selected="selected"></option>
<option value="0">All</option>
<option value="1">At Least</option>
<option value="2">At Most</option>
</select>
如何使值= 0(所有)的默認選定值。