Default text in Angular select

fanhats picture fanhats · Feb 15, 2015 · Viewed 7.3k times · Source

By default angular uses an empty value if nothing has been selected in a <select>. How can I change this to a text that says Please select one?

Answer

Michael Coleman picture Michael Coleman · Feb 15, 2015

You didnt provide any code so I can't give an example relative to your code, but try adding an option element, e.g.

<select ng-model="item" ng-options="item.category for item in items"
        ng-change="doSomething()">
    <option value="">Please select one</option>
</select>