7

New to Angular, and have this simple issue cannot get resolved: I have this html

<input type="number" max="20" step="0.1" name="est_mpg" id="est_mpg" data-ng-model="est.mpg" class="form-control" value="5.00" />

I cannot get default value to show up, what happens it flashes and than disappears, so the box is empty, and i can tick up/down from default min value. It worked fine until I turned the input to type="number" from text.

2 Answers 2

16

Use GruffBunny' solution or as an alternative use ng-init instead of value:

 ng-init="est.mpg=5.00"

Fiddle: http://jsfiddle.net/aY8rE/

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

Comments

7

Default the value of est.mpg to 5.00 in the controller and remove the value attribute.

Comments

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.