如何在Angular.js復(fù)選框中設(shè)置默認(rèn)選項(xiàng)我搜索過谷歌,在上面找不到任何東西。我有這個(gè)密碼。<select ng-model="somethingHere"
ng-options="option.value as option.name for option in options"></select>像這樣的數(shù)據(jù)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>如何將數(shù)據(jù)中的第一個(gè)選項(xiàng)設(shè)置為默認(rèn)值,以便得到如下結(jié)果。<select ng-model="somethingHere" ....>
<option value="0" selected="selected">Something Cool</option>
<option value="1">Something Else</option></select>
如何在Angular.js復(fù)選框中設(shè)置默認(rèn)選項(xiàng)
不負(fù)相思意
2019-06-25 13:31:30