angularJS ng-pattern不起作用
angularJS ng-pattern不起作用
请查看plunker。\nhttp://plnkr.co/edit/DuTFYbLVbPkCIvRznYjG?p=preview\n其中ng-pattern正则表达式不会应用于输入文本字段。\n只有必填验证有效。\nHTML:\n
\nJS:\n
angular.module("app", []).controller("tableController", function ($scope) { $scope.regEx = "/^\\d+$/"; $scope.data = {}; $scope.data.one = 234; $scope.data.two = 32432; $scope.models = [ { name: "one", caption: "cOne", isDisabled: false, isShow: true, minlength: 2, maxlength: 10, pattern: "/^\d+$/" }, { name: "two", caption: "cTwo", isDisabled: false, isShow: true, minlength: 2, maxlength: 5, pattern: "/^\d+$/" }, ]; });
\n有什么建议吗?\n-谢谢