tôi có thể thiết lập một danh sách thả xuống với giá trị mặc định trong angularjs như,Làm thế nào để thiết lập giá trị mặc định trong ng-options
<select name="repeatSelect" id="repeatSelect" ng-model="repeatSelect" ng-init=" repeatSelect = data[0].id">
<option ng-repeat="option in data" value="{{option.id}}">{{option.name}}</option>
</select>
Làm thế nào tôi có thể đạt được cùng sử dụng ng-options
? Tôi treid với,
<select name="repeatSelect"
id="repeatSelect"
ng-model="repeatSelect"
ng-init=" repeatSelect = option.id"
ng-options="option.name for option in data track by option.id">
</select>
Nhưng không sử dụng. Ví dụ fiddle is here
Yup ... Cảm ơn ... – mpsbhat
không hoạt động trong mã của tôi –