Answer the question
In order to leave comments, you need to log in
How to set a template for numbers in Angular?
How to set a template for numbers so that instead of just the number 1, 0001 is written
And if it is not filled, simply 0000 is written
<div class="form-group">
<label >Пример </label>
<input type="number" min="0" max="9999" step="1" ng-model="number" >
</div>
<div>{{number}}</div
Answer the question
In order to leave comments, you need to log in
Use the search engine before the question on the toaster :)
perfect solution
When changing the model by keyup, you can call a function analogous to sprintf, or format (their implementation can be found)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question