Angular ng-pattern - 1 or 2 numbers

1

In the code below, I need to get the ng-pattern to receive 1 or 2 numbers, the format being in minutes, that is, minimum 0 or 00 and maximum 59.

<input type="text" step="any" value="" ng-model="job.ValorIntervalo" min="0" max="60" ng-pattern="/^([0-9]{1}[0-9]{1}$/">

    
asked by anonymous 03.04.2018 / 14:54

1 answer

3

For your validation just put the regular expression below:

^([0-5]{1}\d{1})$|^(\d{1})$

You can run the tests here

    
03.04.2018 / 16:26