AngularJS - 未正确验证正则表达式

时间:2016-05-25 15:16:22

标签: javascript html angularjs regex

我的HTML上有这个输入区域,它获得了应该验证的%值。 我在这里的正则表达式也在regex101.com上尝试过,应该可以正常工作。

<script id="percAnswer" type="text/ng-template">
        <div class="input-group" ng-if="vm.visibility(value)">
            <input type="text" class="form-control" ng-model="value.answer.numericValue" ng-disabled="value.question.readonly" ng-pattern="/^([1-9]{1,2}){1}(\,[0-9]{1,2})?$/" number-format decimals="2" />
            <span class="input-group-addon">%</span>
        </div>
    </script>

不知道为什么,但只允许使用单词。所有数字都被接受,正面和负面。

怎么可能呢?

PS:我还尝试用小数检查一些正则表达式,但没有办法解决这个问题。

0 个答案:

没有答案