amir hosein ahmadi
amir hosein ahmadi

Reputation: 262

angular getting error on `input type number` , ngModel:numfmt on "01234"

i have an error on setting a value in controller like this 01234 and turning it to string for not removing the 0

and getting error on input type number for using the string as a value , i want to showing the zero in input field and cant switch to input type text !

Upvotes: 1

Views: 249

Answers (1)

Simon Schüpbach
Simon Schüpbach

Reputation: 2683

You can just use type tel

<input type="tel" ng-model="myNumber">

and then in controller

$scope.myNumber = "01234";

See this plunker http://plnkr.co/edit/Y5GQiLpENthi7ccok5hJ?p=preview enter image description here

Upvotes: 1

Related Questions