Ngx-mask: Did not reset field with mask directive when send form but this fields is not valid

Created on 11 May 2018  路  5Comments  路  Source: JsDaddy/ngx-mask

Most helpful comment

My Reproducing
Dynamically create phone control field,
type a value and it became valid, but when I submit a form and reset values, all field as expected reset, except field with the mask directive

All 5 comments

My Reproducing
Dynamically create phone control field,
type a value and it became valid, but when I submit a form and reset values, all field as expected reset, except field with the mask directive

Might be close to the same thing, have a form with a masked field that is not touched or dirty. When I submit that form and reset the form, with values being set to the form values that are submitted (for context, its a profile form), the masked field then becomes dirty.

I have the same issue: form.reset() reset value in the form and masked fields but visually fields contain (don't clear) values.

You can always set the formControl value to empty string and then call the reset function, this worked for me:
this.formGroup.get('FORM_CONTROL').setValue('');
this.formGroup.get('FORM_CONTROL').reset();

@brenoprata10 yes, as temporary workaround :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

v1d3rm3 picture v1d3rm3  路  4Comments

salazarr-js picture salazarr-js  路  3Comments

sbeka picture sbeka  路  3Comments

raisiqueira picture raisiqueira  路  3Comments

Wisdomb33r picture Wisdomb33r  路  3Comments