Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User defined component support #921

Closed
matheus-crivellari opened this issue Aug 9, 2021 · 2 comments
Closed

User defined component support #921

matheus-crivellari opened this issue Aug 9, 2021 · 2 comments

Comments

@matheus-crivellari
Copy link
Contributor

🚀 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.

@thekhegay
Copy link

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?

@NepipenkoIgor

@andriikamaldinov1
Copy link
Collaborator

Closed because it's a duplicate #823

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants