ngx-material-keyboard / core

Onscreen virtual keyboard for Angular ≥ 5 (https://angular.io/) using Angular Material (https://material.angular.io/).
https://ngx-material-keyboard.github.io/core/
98 stars 120 forks source link

Problem when using mask in an input field along with the virtual keyboard. #71

Open johnatandantas opened 6 years ago

johnatandantas commented 6 years ago

Help, I'm using the virtual keyboard, it works perfectly when I do not use mask, but when I put a mask in the field it does not format the field. I've already downloaded the demo from vcs and add a mask component and it continues the same thing. I do not know what else to do. Help me.

davidenke commented 6 years ago

Sorry for the late reply: what do you mean with "mask"? Could you provide an example please?

AugustoFaria commented 5 years ago

yep input mask like textmask is not working, i tryed to use a mask for phone like (99) 9999-9999 and the key position don`t work correct? Is a way to work correct with mask?

rancour-a commented 2 years ago

I have the same issue and am looking for a workaround. Any/all input validation seems to be overridden/bypassed when the keyboard directive is present.

LiborSo commented 9 months ago

Just in case anyone still interested, here is the solution. You have to force the control to re-evaluate on each change. You have to make your own directive for the input. Then in directive> In constructor add: @Optional() @Self() private control?: NgControl private elementRef: ElementRef

then for example onInit: this.elementRef.nativeElement.addEventListener("input", (event) => { this.control.control.setValue(this.elementRef.nativeElement.value); this.control.control.updateValueAndValidity(); });