0

I have ng-options fo select list with next format data:

data.dateList.day =  [{"id":1,"value":1},{"id":2,"value":2},{"id":3,"value":3},...]

How I can select option using ng-model when value is equal 2, for example?

Faud
  • 451
  • 3
  • 7
  • 16
  • http://stackoverflow.com/questions/13047923/working-with-select-using-angulars-ng-options – PSL Jun 07 '15 at 17:27
  • There are many more... Also see [official documentation](https://docs.angularjs.org/api/ng/directive/ngOptions). – PSL Jun 07 '15 at 17:28

1 Answers1

0

You can achieve this by using ng-selected as well.

Here is a plunker for you.

 <select>
      <option ng-repeat="day in days" ng-selected="{{day.id == 2}}" value="{{day.id}}">
        {{day.value}}
      </option>
  </select>

http://plnkr.co/edit/DeT1RBr4hDQxX05Qd4ao?p=preview

halfer
  • 19,824
  • 17
  • 99
  • 186
Nikhil Aggarwal
  • 28,197
  • 4
  • 43
  • 59