A
A
Alexander Kovalchuk2015-07-16 15:06:31
css
Alexander Kovalchuk, 2015-07-16 15:06:31

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

3 answer(s)
I
Igor, 2018-11-27
@AlexMine

Use the search engine before the question on the toaster :)
perfect solution

T
TekVanDo, 2015-07-16
@mamut

something like jsbin.com/sadezoxowi/1/edit?html,js,console,output

A
Alexander Zolotykh, 2015-07-16
@zolotykh

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 question

Ask a Question

731 491 924 answers to any question