Page 1 of 1

How to set selected option in select

Posted: Fri Feb 26, 2016 2:51 pm
by Pasteur Miranda

Hi,

Code: Select all

In the Pizza example, I set the select and its options like this: 

Select Options and set its property ng-model = "selected.item" and set ng-options to the value "item.name for item in list".

How can I set a specific option (let's say, the second) to be selected when I open the page? Should I use ng-selected? How?

Code: Select all

 Thanks

How to set selected option in select

Posted: Fri Feb 26, 2016 3:35 pm
by Serhii Kulibaba

Hello,

Please set the value of the variable "selected.item" = second item if the array "list" for that


How to set selected option in select

Posted: Mon Feb 29, 2016 7:27 pm
by Pasteur Miranda

Thank you, Sergiy, it worked!