Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any way to mask material input control?

I want to mask material date control, for that I have tried two npm modules. first, I used ngx-mask and got this Error:

ERROR Error: More than one custom value accessor matches form control with unspecified name attribute

The Reason for the error is; ngx used ValueAccessor in their realization, but angular has a limitation -> we can use only one realization ValueAccessor. That's why ngx-mask doesn't work with material.refre

The Second solution is VanillaTextMask.js and I got some abnormal behavior:

If you try a date like "06/11/1983" you will see the model value is "06/11/1983_",and if you type another number it will get appended. refer

so, can anyone offer some other solution for implementing masking for angular material input control?

like image 917
Neha Bhoi Avatar asked Jun 09 '18 19:06

Neha Bhoi


1 Answers

Try with Text mask, they have to work with angular 2+. Example with stackblitz: https://stackblitz.com/edit/angular-gdqkir

like image 129
Fetrarij Avatar answered Sep 27 '22 19:09

Fetrarij