Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在“选择”中设置空值如果为空,请选择AngularJS_Angularjs - Fatal编程技术网

在“选择”中设置空值如果为空,请选择AngularJS

在“选择”中设置空值如果为空,请选择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

有人能告诉我如何使空值,如果选择列表中没有任何内容,则显示“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="{{$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>