1

can someone tell me how can I make empty value, that if nothing is in list of select, show "n/a"

demo

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

template

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

3
<option ng-repeat=" item in downloadsLists" >{{$index || "n/a"}}</option>
Sign up to request clarification or add additional context in comments.

1 Comment

Some explanation could come quite helpful here.
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>  

Comments

0
 <option value="">N/A </option>  
 <option ng-repeat="item in boards" value="{{$index}}">{{$index}}</option>   

1 Comment

Please elaborate your answer code only answer doesn't tend to help much.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.