You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Setting the default value in a select is a real trap for beginners, questions about how to do this on StackExchange have been view more than 40000 times in the last year. This changes updates the documentation to make it clearer.
Closesangular#12546
selectedOption: {id: '1', name: 'Option A'} //This sets the default value of the select in the ui
155
+
};
156
+
}]);
157
+
</script>
158
+
<div ng-controller="ExampleController">
159
+
<form name="myForm">
160
+
<label>
161
+
Make a choice: </label>
162
+
<select name="mySelect" ng-options="option.name for option in data.availableOptions track by option.id" ng-model="data.selectedOption" required></select>
0 commit comments