Mask or format input value at angular2

Asked

Viewed 797 times

1

How can I format or use masks on inputs with angular2, for example for money

In this input:

<input type="text" class="form-control input-sm text-right" id="representPercDiagnostico" 
                    placeholder="DIAGNÓSTICO"
                    required [(ngModel)]="questionario3.RepresentPercDiagnostico" (blur)="somaValores()">

If the user type a value it will appear in the typed form, but I would like it to appear formatted, for example: if the user type 205.5 I would like it to appear 205.50.

In other cases also use masks for telephone numbers, for example: (00)12345678.

  • Just remembering that for the Brazilian format, you have to import the language... angular-locale_pt-br.js

  • I’m using Angular2 Ivan, could you give me an example of how to use, I couldn’t understand.

  • You can Use the Library ngx-currency , It is great for creating masks, has a lot of settings, with this you can customize it to meet your needs.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.