I am trying to validate the user input of a text field using e-pattern from the angular-xeditable directive. I have built the regular expression using an online regex builder/tester and it does exactly what I want however angular-xeditable doesn't seem to recognize the expression as being valid. It shows the below even when the expression is valid.
requirements:
valid entry: 0.5, 0.95, 0.40, 1.0
regex:
^((0+(\.[0-9][05]?))|1+(\.0))$
code:
<span e-pattern="/^((0+(\\.[0-9][05]?))|1+(\\.0))$/" e-required ng-show="!tableform.$visible" editable-text="user.available" e-form="tableform" onbeforesave="checkAvailable($data)">{{ user.available}} </span>
message:
Is there anything I'm missing or need to amend to the expression or span tag?
失败了,我只是想出了一个问题,它非常简单的电子模式在表达式之前或之后不需要/ ^或$ /,应改为:
e-pattern="((0+(\.[0-9][05]?))|1+(\.0))"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.