Skip to content

MaskDirective not supporting dynamic pattern attribute binding #50

@EngFelix

Description

@EngFelix

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions