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

MaskDirective not supporting dynamic pattern attribute binding #50

Closed
EngFelix opened this issue Apr 13, 2021 · 1 comment
Closed

MaskDirective not supporting dynamic pattern attribute binding #50

EngFelix opened this issue Apr 13, 2021 · 1 comment

Comments

@EngFelix
Copy link
Contributor

I am trying to build a component that allows passing in a dynamic pattern string value.

my.component.html:

<input [id]="id" 
       type="text"
       ...
       mask
       [pattern]="pattern"
       [placeholder]="placeholder">

It works when I use 'pattern="^somePattern$"', but not when using dynamic attribute binding.
This is because the variable 'this.regex' is set in the constructor, where the pattern is still not present.

I think this can be resolved by setting the variable in an appropriate lifecycle hook.

Version: 2.2.2

changhuixu added a commit that referenced this issue Apr 14, 2021
MaskDirective: Support for dynamic pattern - fixing issue #50
@changhuixu
Copy link
Owner

merged your pull request. Thank you.
released v2.2.3

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

No branches or pull requests

2 participants