You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been using ngx-mask for very long now, and I've come into need to use mask directive with my own input component.
Describe the solution you'd like
For example, when I need to make a standardized text input component for my whole project.. I use to create my own text input component, which uses to have a native input element inside and uses to implement ControlValueAccessor so I can use it with Template Driven Forms and Reactive Forms. I know I can put mask directive inside my own input component.
But the thing is I think it makes more sense to leave this responsibility to a parent component using my input component so it can decides which input has mask or not. So I think not restricting mask selector only to input[mask], textarea[mask] would be interesting.
Describe alternatives you've considered
As a quick solution, I created in my own component a "mask" attribute input so I can pass desired mask to it and made a conditional in my custom text input component's html template to display an input element with mask directive when my component has mask attribute defined and display an input element without mask directive when my component has not.
So I really think this looks like an overhead of logic to my component once ControlValueAccessors and directives should handle these things and make components more generalistic.
The text was updated successfully, but these errors were encountered:
I have same behavior, I'm developing angular components library with ControlValueAccessor.
And I want to add ngx-mask to my library. So, another solution to discuss is to add CDK maybe?
🚀 feature request
Description
I've been using ngx-mask for very long now, and I've come into need to use mask directive with my own input component.
Describe the solution you'd like
For example, when I need to make a standardized text input component for my whole project.. I use to create my own text input component, which uses to have a native input element inside and uses to implement ControlValueAccessor so I can use it with Template Driven Forms and Reactive Forms. I know I can put mask directive inside my own input component.
But the thing is I think it makes more sense to leave this responsibility to a parent component using my input component so it can decides which input has mask or not. So I think not restricting mask selector only to
input[mask], textarea[mask]
would be interesting.Describe alternatives you've considered
As a quick solution, I created in my own component a "mask" attribute input so I can pass desired mask to it and made a conditional in my custom text input component's html template to display an input element with mask directive when my component has mask attribute defined and display an input element without mask directive when my component has not.
So I really think this looks like an overhead of logic to my component once ControlValueAccessors and directives should handle these things and make components more generalistic.
The text was updated successfully, but these errors were encountered: