Hi I have an input field where I want to do validation such that input only has numbers but with dashes and 11 number maximum
i.e 1233-224-1234
I have following validation applied that only accepts numbers
<input ng-pattern="customNum" ng-model=value.id />
In my controller I have
function myCtrl($scope) {
$scope.customNum = /^\d+$/;
}
Please let me know how i can update this so that 13 digits are entered out of which 11 are numbers and two are dashes. Thanks
^\d{4}-\d{3}-\d{4}$?ng-patternwith a regex. You can find examples of that here: stackoverflow.com/questions/123559/…