Search code examples
angularjsng-optionsangularjs-select

Default text in Angular select


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?


Solution

  • 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>