Search code examples
angularionic2angular2-formsproductiondev-to-production

Pattern in production makes the form field and overall form invalid


I am using template driven form in ionic-angular project.

<input type="password" ngModel required name="password" pattern="(?=.*\[0-9])(?=.*\[a-z]).{6,}"></input>

The above input filed works fine in development mode.But in production it displays as invalid.

The value of the password field is valid if I enter 'aaaaaaa@123' in development and in production the same value becomes invalid.


Solution

  • Try to remove backslash escape characters from your regexp. It should look like this:

    (?=.*[0-9])(?=.*[a-z]).{6,}