I have a ng-pattern validation on my input
This does not work the same everytime. And shows very weird behaviour.
The ngMessage is only shown on every second character I type. But the console evaluates the regex test correctly.
I set a breakpoint in the browser dev tool on the line in angular that tests the regex and did some debugging in the console. Here is the console output from my debugging. The debugger did not move while I was using the console so no values had been changed. (-> represents my input, <- is what the debugger spits out)
-> regexp.test(viewValue) <- false -> regexp <- /^(.+)$/g -> /^(.+)$/g.test(viewValue) <- true -> regexp.test(viewValue) <- true
Can someone tell me what is going on? Note how regexp.test(viewvalue) was false first, then was true on the last test without anything changing.
©2020 All rights reserved.