0

DEMO

I have an select tag which i am using ng-model to get the selected value. The Select tag shows Empty first value, it should be showing Choose. What i am doing wrong?

<select ng-model="todo.opts">
    <option>Choose</option>
    <option><25%</option>
    <option>25-50%</option>
    <option>>50%</option>
</select>

2 Answers 2

4

Try to set the todo.opts variable in the scope as the value you want to select as a default. By the way check documentation for the ng-option

Sign up to request clarification or add additional context in comments.

Comments

3

Since your model will be empty to begin with, you can easily select the Choose option by giving it an empty value:

<div ng-app="app" ng-controller="myCtrl">
    <select ng-model="opts">
        <option value="">Choose</option>
        <option><25%</option>
        <option>25-50%</option>
        <option>>50%</option>
    </select>
</div>

Here is an updated fiddle.

2 Comments

Yep, but you should rather give a value for all those options, and set the default value in your controller
@edi9999 or use ng-init to set the default

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.