core icon indicating copy to clipboard operation
core copied to clipboard

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

Open johnatandantas opened this issue 6 years ago • 4 comments

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.

johnatandantas avatar Jul 02 '18 02:07 johnatandantas

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

davidenke avatar Sep 10 '18 09:09 davidenke

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?

AugustoFaria avatar Jan 04 '19 18:01 AugustoFaria

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.

rancour-a avatar Mar 30 '22 11:03 rancour-a

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(); });

LiborSo avatar Jan 18 '24 10:01 LiborSo