You can use ng-init like this as per the code demonstration:-
<select ng-init="somethingHere = options[0]" ng-model="somethingHere" ng-options="option.name for option in options"> </select> |
ng-init="somethingHere = options[0]": This will set here the somethingHere variable to the first object in the options array when the component gets loaded. Thus, the first option becomes the default selected value in the dropdown.
ng-model="somethingHere": This binds the selected value of the dropdown to the somethingHere variable, which you can then access in your AngularJS controller.
ng-options="option.name for option in options": It will create dropdown options which depend on the name property of every object in the options array.
Output:
On running this, it initializes the dropdown to "Something Cool" automatically (as the first option), which you'll notice has assigned the value somethingHere. That's short, sweet, and quite effective in defaulting a value without needing a controller to do more.