AngularJS - Draw a Select with default option

In the following example, we set a default option for our users to see. We could leave it blank but it would not help our user. We could also preselect one of our options as the default one but sometimes we do not want to influence or dictate our user’s selection.

<form name="myForm">
    <select ng-options="color for color in ['red', 'blue', 'yellow']" ng-model="color1">
        <option value="" selected>--Please select your color--</option>
    </select>
</form>

Note: it is important that our default option has value set to nothing.

For more information go to the AngularJS “select” documentation

comments powered by Disqus