如何在Angular.js复选框中设置默认选项我搜索过谷歌,在上面找不到任何东西。我有这个密码。<select ng-model="somethingHere"
ng-options="option.value as option.name for option in options"></select>像这样的数据options = [{
name: 'Something Cool',
value: 'something-cool-value'}, {
name: 'Something Else',
value: 'something-else-value'}];输出就是这样。<select ng-model="somethingHere"
ng-options="option.value as option.name for option in options"
class="ng-pristine ng-valid">
<option value="?" selected="selected"></option>
<option value="0">Something Cool</option>
<option value="1">Something Else</option></select>如何将数据中的第一个选项设置为默认值,以便得到如下结果。<select ng-model="somethingHere" ....>
<option value="0" selected="selected">Something Cool</option>
<option value="1">Something Else</option></select>
添加回答
举报
0/150
提交
取消