Ngx-mask: Does not work with reactive forms

Created on 29 May 2018  路  2Comments  路  Source: JsDaddy/ngx-mask

When using this directive on an input tied to an AbstractControl (FormControl tied to FormGroup) it breaks the control causing the value for it to never update.

Most helpful comment

@StephenRiosDev what was your solution?

All 2 comments

@StephenRiosDev what was your solution?

Had the same issue, ended up writing my own masking function and binding it through an (input), e.g.

<input type="text" class="form-control form-control-lg" id="zip"
                                       [formControl]="visionPlanRouterForm.controls['zip']"
                                       (input)="maskZip()" maxlength="10" placeholder="Enter ZIP Code">

and in my component:

    public maskZip(): void {
        // calls form helper and performs masking
        this.fh.maskZip(this.visionPlanRouterForm, 'zip');
    }
Was this page helpful?
0 / 5 - 0 ratings

Related issues

tanjuyayak picture tanjuyayak  路  3Comments

ghost picture ghost  路  3Comments

TimWarp picture TimWarp  路  4Comments

cabbott65 picture cabbott65  路  4Comments

dimmal picture dimmal  路  3Comments