How to have a default option in Angular.js select box

后端 未结 23 1836
悲哀的现实
悲哀的现实 2020-11-22 06:04

I have searched Google and can\'t find anything on this.

I have this code.


This way of doing it is better because when you want to replace the list of strings with list of objects you will just change this to

 

where somethingHere is an object with the properties name and id, of course. Please note, 'as' is not used in this way of expressing the ng-options, because it will only set the value and you will not be able to change it when you are using track by

提交回复
热议问题