2017-11-15 8 views
1

であれば、誰かがあれば、何も選択し、ショーのリストにないことを、どのように私は空の値を作ることができる私に言うことができる選択の内側に空の値を設定する「N /」は、空の選択AngularJS

demo 

https://codepen.io/Turqus/pen/wPrKrr?editors=1010

テンプレート

<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> 

答えて

3
<option ng-repeat=" item in downloadsLists" >{{$index || "n/a"}}</option> 
+0

いくつかの説明がここで非常に役立つことがあります。 – lealceldeiro

+0

このオプションは機能しません:( –

0
<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> 
0
<option value="">N/A </option> 
<option ng-repeat="item in boards" value="{{$index}}">{{$index}}</option> 
+1

あなたの回答コードだけを詳しく説明してください。 – Jeet

関連する問題