Angular Mask Doubts

2

Hello, I'm new to Angular and I'm having mascara problems! I'm using the masks of: "Angular-input-mask";

I have a form that has a 'CPF' field, the mask is applied perfectly. Visually when I type a letter, this letter does not appear in the field, since the field 'CPF' only accepts numbers! But when I type a letter, that letter is stored with input, and my formGroup validation is automatically activated. I would like to know how I can prevent this!

In the photo below, I displayed the value of my form and its fields and typed a letter. Notice that the 'CPF' field is empty, but the value of the input is filled with the letter you typed ..

FormCode...

    
asked by anonymous 11.04.2018 / 15:12

1 answer

2

Summarizing the problem was that you were mixing the reactive forms (formControlName) with the template forms (ngmodel). In this case either you create your own mascara or look for another library that works with reactive forms .

In this case you just need to look up the cpf regex and apply it to the element.

    
11.04.2018 / 16:44