One way to set a dropdown list with a default value in AngularJS is by using the following code:
<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>
Alternatively, you can achieve the same result using ng-options
. Attempting this method may look like:
<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>
However, if this second method does not work as expected, you can refer to a sample fiddle provided here.