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
3
votes
1 answer

Validation for latitude and longitude values using ng-pattern

I have used ng-pattern /^[0-9]{1,7}(\.[0-9]+)?$/ for validate latitude and longitude values, but this pattern is not allowing me to enter negative values. Latitude and longitude values contains negative and decimal values Can you please suggest…
NIKHIL K A
  • 328
  • 5
  • 16
3
votes
1 answer

How to prevent AngularJS from validating form controls for the first time

I my form I have some input controls which are bounded with controller's scope data. Based on users selection I am bounding selected item by using ng-model to input controls. I am validating those inputs by using ng-maxlength ,minlength ,ng-pattern…
Pavan Tiwari
  • 3,077
  • 3
  • 31
  • 71
3
votes
4 answers

Angular ng-pattern for date not working on IE9

I am trying to use below date (mm/dd/yyyy) validation pattern using ng-pattern in view. ng-pattern="/^(\d{4})-(\d{2})-(\d{2})$/" As soon as I start typing the date the validation error appears and stays even after having valid date such as…
seUser
  • 1,093
  • 2
  • 10
  • 21
2
votes
0 answers

Condition based ng-pattern

I want the ng-pattern value to change based on a condition like :
2
votes
1 answer

regex expression from data base not working in angular directive ng-pattern

I have a form in angular where the inputs (name, email, phone number, ect) are generated using an angular Directive: .directive('camposProductos', function () { return { restrict: 'AEC', template: '
2
votes
1 answer

ng-pattern that allows decimal ratios

I'm having an ng-pattern that validates for a ration like 4:6 as shown below: ng-pattern="/^(\d+):(\d+)$/" I want also to validate if decimal numbers are entered as rations along with the above validation.Example :5.4:7.1 I trid by giving…
forgottofly
  • 2,729
  • 11
  • 51
  • 93
2
votes
1 answer

Regex with min 8 digits, 20 characters

I'm currently looking for a regex that verify's the following requirements: Should contain atleast 8 digits (0-9). Between the digits it is allowed to use other characters (a-z) (also upper case). It should contain max 20 characters (a-z…
JeroenE
  • 603
  • 7
  • 22
2
votes
3 answers

Regex to validate that the first letter of a word in input field is not a special character

I am using angularjs. I want to use validation for my name field. I am a beginner in regex expressions. I want that the first letter of the name is not a special Character. For E.g My$Repo should be valid and $MyRepo is invalid. I am using…
shaaa
  • 227
  • 1
  • 7
  • 22
2
votes
1 answer

ng-pattern for only hebrew characters

I want to use ng-pattern validate my text input field that should accept only Hebrew characters, sometimes the input are ok and sometimes they are being rejected for some reason. (the first one is validate the second letter is not and…
2
votes
1 answer

Using ng-pattern does not work from controller or JSON

I have this code which will only accept 6 digit numeric: {{widget.regex}}
sg552
  • 1,521
  • 6
  • 32
  • 59
2
votes
1 answer

Bypass default wrapping of ^and $ in ng-pattern

Im getting my regex from an API, and they often starts with ^ and ends with $ (for example ^-?[0-9]+$). Just putting the regex as a string to ng-pattern results in a Lexer Error, since angular adds the ^ and $ by default on strings. From Angular API…
Jimmy Mattsson
  • 2,085
  • 5
  • 19
  • 34
2
votes
1 answer

ng-pattern regular expression for real number

This is more a question for my own curiosity. I have a working solution, but I'm curious if anybody has any insight as to why one solution works and the other does not. I needed a regular expression to validate a user has entered a valid number.…
mike
  • 536
  • 1
  • 6
  • 16
2
votes
1 answer

RegEx to allow numbers and only one dot - E.g. it should not allow 1.1

I want my hours input field to allow only numbers utill 2nd decimal point (numbers with only a single dot). I used this expression for the same /^[0-9]+(\.[0-9]{1,2})?$/ and this allows 1.1. which should not be allowed
2
votes
1 answer

ng-pattern regex Error: [$parse:lexerr] Lexer Error

I have this as my regex pattern (^([Aa][Ss])[0-9]{8})|(^6[0-9]{7}) i get console errors below, but it works!: libraries-c8d65edf41.js:22505 Error: [$parse:lexerr] Lexer Error: Unexpected next character at columns 1-1 [^] in expression…
2
votes
1 answer

Angular - Form control ngPattern to check both letters and numbers?

I'm writing a form in Angular and I have one criteria that requires that I need to check for that requires the input to ONLY contain letters and numbers AND the first character cannot be a number. Is there any way to easily check this in Angular.…
Keren
  • 379
  • 6
  • 16
1
2
3
11 12