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.
Look for Filter of the Angular JS, here the default types.
– Ivan Ferrer
Just remembering that for the Brazilian format, you have to import the language...
angular-locale_pt-br.js
– Ivan Ferrer
I’m using Angular2 Ivan, could you give me an example of how to use, I couldn’t understand.
– Edmar Munhoz
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.
– Allisson Filipe