Questions tagged [ng-pattern]

HTML input element control with angular data-binding. Input control follows HTML5 input types and polyfills the HTML5 validation behavior for older browsers.

HTML input element control with angular data-binding. Input control follows HTML5 input types and polyfills the HTML5 validation behavior for older browsers.

Source: http://docs.angularjs.org/api/ng/directive/input

170 questions
1
vote
4 answers

Integer only validation for angularjs ng-pattern

How to validate positive integer numbers using ng-pattern. Now i have this pattern ^[0-9]{1,7}(\.[0-9]+)?$/. But it allows decimal values. I need to disallow decimal values too
byteC0de
  • 5,153
  • 5
  • 33
  • 66
1
vote
1 answer

ng-pattern not thowing an error

Been trying to figure this out for hours. Figured I would ask here. I have an input field and I simply want to display a message if someone tries to type in a number instead. My research lead me to ng-pattern but I can't seem to figure out why it…
Sericet
  • 21
  • 6
1
vote
1 answer

ng-pattern for exclusion group of numbers

I have a list of exclusion numbers. for example (400276|400615|402914|404625) the pattern should not let me enter into the input any of these numbers as the first 6 digits example 400276123 .BAD. because the value init with a number to…
Ivan Paredes
  • 465
  • 2
  • 5
  • 20
1
vote
2 answers

Regex for a number which can starts with 0

I use this regex for my field: /^([1-9]([0-9]){0,3}?)((\.|\,)\d{1,2})?$/; What I want to do is to allow the user to enter 0 as a beginning of the number, but in this cas, he must enter at least a second digit diffrent from 0 and the same rule is…
Anna
  • 839
  • 2
  • 17
  • 33
1
vote
1 answer

ng-pattern to allow numbers from certain range before and after decimal

How to limit numbers for before and after the decimal point, something like before decimal should be from 0-30 and after decimal should be from 0-15 Correct: 30.15 Wrong: 30.16 Correct: 30.09 or 30.9 Correct: 0.15 Wrong: 0.16 Correct: 21.14 Wrong:…
User2309
  • 35
  • 1
  • 5
1
vote
1 answer

The use of 'ng-pattern' with 'ng-match' in form validation

Hello I am trying to create a simple form with a password and confirm-password inputs. I found out that 'ng-pattern' and 'ng-match' don't work so good together. Until the password tag is not populated with a value,and it doesn't until it matches…
user24136
  • 135
  • 4
  • 13
1
vote
5 answers

Regular Expression for minimum value 18 and maximum 99 with leading zero

Regular Expression for minimum value 18 and maximum 99 with leading zero. Means my number should be from 18 to 99. With one condition of leading zero i.e 18 == 018, 99 == 099
Himanshu Shekhar
  • 1,196
  • 1
  • 16
  • 35
1
vote
1 answer

AngularJS allow only integer numbers in number input field

Can't understand how to add ng-pattern that will mark field as invalid for all not valid entries. I have tried to use this one "/^(0|\-?[1-9][0-9]*)$/ It works quite well with filtering numbers like 0.1 or even 0123 which are not valid (and not…
Rantiev
  • 2,121
  • 2
  • 32
  • 56
1
vote
2 answers

How to validate an angularjs in textbox?

Why is my ng-pattern in textbox of name is allowing special characters? This is the view file:
Ronnel Gonzales
  • 143
  • 1
  • 4
  • 12
1
vote
0 answers

angular ng-pattern currency regular expression

I'm trying to write a regular expression for ng-pattern that will pass on the following cases: .1 - Pass .01 - Pass 0.01 - Pass 1 - Pass 1.0 - Pass 1.00 - Pass $1.00 - Pass $1000 - Pass $1,000 - Pass $1,000,000.00 Pass 11,11 - Fail 11.111 -…
JamesNB
  • 27
  • 13
1
vote
1 answer

Pattern that restricts user to enter special characters for first character

I have a requirement for an input field that should allow numbers, alphabets, and special characters like #,$,%,^ etc. But with only one condition the first character that I enter in the text box should not be a special character. Example: @Test123…
forgottofly
  • 2,729
  • 11
  • 51
  • 93
1
vote
3 answers

How to set mask on input

I've select with types of credit card and input for number. For validating number i use ng-patter? for masking i want use jquery iputmask, but mask not set. How can i set dynamicly set mask on select change?

With…

user7102903
  • 23
  • 1
  • 6
1
vote
0 answers

How to validate image, date, checkbox and radio button in AngularJS?

How to validate image, date, checkbox and radio button in angular.js? What is ng-pattern for checkbox, radio button, image and date or good plugin available for validation? How to add validator.rule for these fields?
1
vote
1 answer

issue with ngPattern

I am trying to design a nifty expiration date input on a credit card checkout form that will automatically insert a " / " between expiration month and year while the user is typing. The model no longer picks up the input value since I have…
alaboudi
  • 3,187
  • 4
  • 29
  • 47
1
vote
1 answer

Getting ng-patten as a variable from a service

Hello I am running an app wich needs a lot of form validation across pages, so I am trying to get validation patterns from a service i am using amongst the controllers. The problem here is the ng-pattern isn't reacting the right way when I enter a…