AngularJS Login Type = Default Number

New to Angular, and this simple problem cannot be solved: 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 can’t get the default value so that it is displayed, what is happening, it blinks and disappears, so the field is empty, and I can tick up / down from the default value of min. It worked fine until I turned on input of type = "number" from the text.

+5
source share
2 answers

Use the GruffBunny solution or alternative use ng-initinstead value:

 ng-init="est.mpg=5.00"

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

+15
source

est.mpg 5,00 .

+7

Source: https://habr.com/ru/post/1529586/


All Articles