在“选择”中设置空值如果为空,请选择AngularJS
有人能告诉我如何使空值,如果选择列表中没有任何内容,则显示“n/a”吗 模板在“选择”中设置空值如果为空,请选择AngularJS,angularjs,Angularjs,有人能告诉我如何使空值,如果选择列表中没有任何内容,则显示“n/a”吗 模板 <div ng-app="test" ng-controller="select"> <select class="form-control" ng-model="selectedBoard" ng-change="changeBoard(selectedBoard)"> <option ng-repeat="item in boards" value="{{$in
<div ng-app="test" ng-controller="select">
<select class="form-control" ng-model="selectedBoard" ng-change="changeBoard(selectedBoard)">
<option ng-repeat="item in boards" value="{{$index}}">{{$index}}</option>
</select>
<select class="form-control" ng-model="selectedList">
<option ng-repeat="item in downloadedLists" value="{{$index}}">{{$index}}</option>
</select>
</div>
{{$index}}
{{$index}}
{{$index | |“n/a”}
不适用
{{$index}}
不适用
{{$index}}
请详细说明您的答案代码-只有答案没有多大帮助。这里的一些解释可能会非常有用。
<div ng-app="test" ng-controller="select">
<select class="form-control" ng-model="selectedBoard" ng-change="changeBoard(selectedBoard)">
<option ng-repeat="item in boards" value="{{$index}}">{{$index}}</option>
</select>
<select class="form-control" ng-model="selectedList">
<option ng-repeat="item in downloadedLists" value="{{$index}}">{{$index}}</option>
</select>
</div>
<option ng-repeat=" item in downloadsLists" >{{$index || "n/a"}}</option>
<select class="form-control" ng-model="selectedList">
<option disabled selected value
ng-show="downloadedLists.length == 0">n/a</option>
<option ng-repeat="item in downloadedLists" value="{{$index}}">{{$index}}</option>
</select>
<option value="">N/A </option>
<option ng-repeat="item in boards" value="{{$index}}">{{$index}}</option>