udos86 / ng-dynamic-forms

Rapid form development library for Angular

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for Masks when using Angular Material

thomastardy opened this issue · comments

I'm submitting a


[ ] Bug / Regression
[x] Feature Request / Proposal

I'm using


NG Dynamic Forms Version: `14.0.1`

[ ] Basic UI
[ ] Bootstrap UI  
[ ] Foundation UI
[ ] Ionic UI
[ ] Kendo UI
[x] Material  
[ ] NG Bootstrap
[ ] Prime NG

Description

We've started using NG Dynamic Forms version 6.0.7 in a form-heavy application of ours where we use Angular Material as well. This worked perfectly and help us save lots of from code. We have quite a lot of inputs where we make use of masks.
In the process of updating the application we wanted to update NG Dynamic Forms to the latest version but have seen that masks are not supported anymore when Angular Material is used.

Is there a way to bring the support for mask back when used with Angular Material?

Hi,

I have the same issue.
After some research i found a workaround here angular/angular#16755 (comment)
I didn't figure out how to add a tag in the model to use @ViewChild(tag) so i use document element :

constructor( ...
    @Inject(DOCUMENT) document ) {
}

public ngAfterViewInit() {
    const date =  document.getElementById( 'date' );
    const mask = [/\d/, /\d/, '/', /\d/, /\d/, '/', /\d/, /\d/, /\d/, /\d/];
    textMask.maskInput( {
      inputElement: date,
      mask: mask
    } );
}

Hope it's help