【发布时间】:2014-04-21 13:47:45
【问题描述】:
只是尝试在 Angular 中设置默认选定值,但到目前为止我没有运气。
编译前的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>
如何使 value=0 (All) 成为默认选择值。
【问题讨论】:
标签: angularjs angularjs-ng-repeat angularjs-ng-init