You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 1, 2020. It is now read-only.
Copy file name to clipboardExpand all lines: changelog.txt
+2-1Lines changed: 2 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -12,4 +12,5 @@ Angular-Validation change logs
12
12
1.3.8 (2015-03-15): Added between/min/max conditional validators on all Date types (ISO, EURO_LONG, EURO_SHORT, US_LONG, US_SHORT)
13
13
1.3.9 (2015-03-21): Added validation summary through 2 new and equivalent properties `$scope.$validationSummary` and `$scope.formName.$validationSummary`. Also added `bower` and `gulp` support, the Gulp script gives minified files.
14
14
1.3.10 (2015-03-28): Added new function of `checkFormValidity()` before submitting the form. Now use only 1 minified script instead of multiples.
15
-
1.3.11 (2015-03-30): Accepted pull request #15 to fix form without name attribute. Also accepted pull request #18 to add Spanish locales.
15
+
1.3.11 (2015-03-30): Accepted pull request #15 to fix form without name attribute. Also accepted pull request #18 to add Spanish locales.
16
+
1.3.12 (2015-04-04): Fix issue #16 and added Validators Alternate Text option on all type of validators. Also fixed removeValidator and clean a lot of code.
Copy file name to clipboardExpand all lines: readme.md
+43-35Lines changed: 43 additions & 35 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
#Angular Validation (Directive / Service)
2
-
`Version: 1.3.11`
2
+
`Version: 1.3.12`
3
3
### Form validation after user inactivity of default 1sec. (customizable timeout)
4
4
5
5
Forms Validation with Angular made easy! Angular-Validation is an angular directive/service with locales (languages) with a very simple approach of defining your `validation=""` directly within your element to validate (input, textarea, etc) and...that's it!!! The directive/service will take care of the rest!
@@ -22,20 +22,20 @@ Huge rewrite to have a better code separation and also adding support to Service
22
22
23
23
<aname="index"></a>
24
24
## Index
25
-
*[Plunker Demo](#plunker)
26
-
*[Dependency](#dependencies)
25
+
*[Available Validators](#validators)
26
+
*[Bootstrap Input Groups Wrapping - HOWTO](#input-groups-wrapping)
27
+
*[Changelog](#changelog)
28
+
*[Demo - Plunker](#plunker)
29
+
*[Dependencies](#dependencies)
30
+
*[Form Submit and Validation](#submit)
27
31
*[Install (bower)](#install)
28
32
*[Include it in your app project](#project)
33
+
*[Locales (languages)](#locales)
34
+
*[Regular Expressions (Regex)](#regex)
29
35
*[Requirements](#requirements)
30
36
*[Some Working Examples (Directive)](#examples-directive)
31
37
*[Some Working Examples (Service)](#examples-service)
32
-
*[Form Submit and Validation](#submit)
33
38
*[Validation summary](#validation-summary)
34
-
*[Bootstrap Input Groups Wrapping - HOWTO](#input-groups-wrapping)
35
-
*[Regular Expressions (Regex)](#regex)
36
-
*[Locales (languages)](#locales)
37
-
*[Available Validators](#validators)
38
-
*[Changelog](#changelog)
39
39
40
40
<aname="install"></a>
41
41
Install
@@ -177,8 +177,11 @@ P.S. For real live sample, see the [live demo](#plunker) or download the Github
177
177
178
178
// you can also remove a Validator with an ngClick or whichever way you prefer by calling .removeValidator()
From the example displayed, I introduce the custom regular expression, there is no limitation on regex itself and you can even use the pipe " | " within it and without being scared of interfering with the other validation filters BUT you have to follow a specific pattern (a writing pattern that is), and if you don't, well it will simply fail. Let's explain how it works...
281
-
282
-
Regex validation is divided in 4 specific parts (Step #1-4).
283
-
284
-
Let's use the previous [Examples #5](#examples-directive) and extract the information out of it to see how it works.
285
-
Step #1-4 are for explanation only, at the end we show the full regex (make sure there is no spaces).
286
-
287
-
1. Start & end the filter with the following `regex: :regex` which tells the directive where to extract it.
288
-
289
-
2. Custom error message `YYWW` (what do we want to display to the user, it will be appended to INVALID_PATTERN, refer to the translation file. In english it will display the following: Must be following this format: YYWW)
290
-
291
-
3. Followed by a separator which basically says... after `:=` separator comes the regex pattern
Final code (without spaces): `regex:YYWW:=^(0[9]|1[0-9]|2[0-9]|3[0-9])(5[0-2]|[0-4][0-9])$:regex`
296
-
297
280
<aname="locales"></a>
298
281
Locales (languages)
299
282
--------------------
@@ -314,11 +297,35 @@ $scope.switchLanguage = function (key) {
314
297
```
315
298
*P.S. If you define a new Language set, please make a pull request and I would be happy to add them in current project... It would be nice to have Spanish, German or even Chinese :) Thank you.*
316
299
300
+
<aname="regex"></a>
301
+
Regular Expressions (Regex)
302
+
--------------------
303
+
From the example displayed, I introduce the custom regular expression, there is no limitation on regex itself and you can even use the pipe " | " within it and without being scared of interfering with the other validation filters BUT you have to follow a specific pattern (a writing pattern that is), and if you don't, well it will simply fail. Let's explain how it works...
304
+
305
+
Regex validation is divided in 4 specific parts (Step #1-4).
306
+
307
+
Let's use the previous [Examples #5](#examples-directive) and extract the information out of it to see how it works.
308
+
Step #1-4 are for explanation only, at the end we show the full regex (make sure there is no spaces).
309
+
310
+
1. Start & end the filter with the following `regex: :regex` which tells the directive where to extract it.
311
+
312
+
2. Custom error message `YYWW` (what do we want to display to the user, it will be appended to INVALID_PATTERN, refer to the translation file. In english it will display the following: Must be following this format: YYWW)
313
+
314
+
3. Followed by a separator which basically says... after `:=` separator comes the regex pattern
Final code (without spaces): `regex:YYWW:=^(0[9]|1[0-9]|2[0-9]|3[0-9])(5[0-2]|[0-4][0-9])$:regex`
319
+
317
320
<aname="validators"></a>
318
321
Available Validators
319
322
--------------------
320
-
All validators are written as `snake_case` but it's up to the user's taste and could also be written as `camelCase`. So for example `alpha_dash_spaces` and `alphaDashSpaces` are both equivalent.
323
+
All validators are written as `snake_case` but it's up to the user's taste and could also be used as `camelCase`. So for example `alpha_dash_spaces` and `alphaDashSpaces` are both equivalent.
324
+
325
+
NEW Alternate Text: Validators can now use alternate text instead of the usual defined locale $translate text, for example it could be useful to see a different text on a `<select>` instead of the usual "Field is Required". This works on all type of validators and is defined by adding `:alt=` at the end of any validator and could be used on 1 validator or multiple validators. For example: `validation="required:alt=Your Alternate Required Text."` or `validation="date_iso_between:2015-03-01,2015-03-30:alt=Provide a Booking Date for April|required:Booking Date is Required"`. You could also use the `$translate` on the provided text, for example in the Directive you can use `validation="required: {{ 'YOUR_TEXT' | translate }}"` or in the Service you can use `....addValidator('input1', 'required:alt=' + $translate.instant('YOUR_TEXT'));`
326
+
321
327
##### NOTE: on an `input type="number"`, the `+` sign is an invalid character (browser restriction) even if you are using a `signed` validator. If you really wish to use the `+`, then change your input to a `type="text"`.
328
+
322
329
*`alpha` Only alpha characters (including latin) are present (a-z, A-Z)
323
330
*`alpha_spaces` Only alpha characters (including latin) and spaces are present (a-z, A-Z)
324
331
*`alpha_num` Only alpha-numeric characters (including latin) are present (a-z, A-Z, 0-9)
@@ -366,7 +373,7 @@ All validators are written as `snake_case` but it's up to the user's taste and c
366
373
*`ipv6` Check for valid IP (IPv6)
367
374
*`ipv6_hex` Check for valid IP (IPv6 Hexadecimal)
368
375
*`match:n` Match another input field(n), where (n) must be the exact ngModel attribute of input field to compare to.
369
-
*`match:n,t` Match another input field(n), same as (match:n) but also include (t) for alternative text to be displayed in the error message.
376
+
*`match:n,t` Match another input field(n), same as (match:n) but also include (t) for alternate text (this only replace the input name) to be displayed in the error message.
370
377
*`max_date_iso` alias of `date_iso_max`.
371
378
*`min_date_iso` alias of `date_iso_min`.
372
379
*`max_date_euro_long` alias of `date_euro_long_max`.
@@ -418,4 +425,5 @@ License
418
425
*[1.3.8](https://github.com/ghiscoding/angular-validation/commit/492d1060a91fb8b49fc70a0c7a1a581d904e0db0)`2015-03-15` Added between/min/max conditional validators on all Date types (iso, euro_long, euro_short, us_long, us_short)
419
426
*[1.3.9](https://github.com/ghiscoding/angular-validation/commit/931d3b04a00f0583612aefe28ad0bfcac326a38c)`2015-03-21` Added validation summary through 2 new and equivalent properties `$scope.$validationSummary` and `$scope.formName.$validationSummary`. Also added `bower` and `gulp` support, the Gulp script gives minified files.
420
427
*[1.3.10](https://github.com/ghiscoding/angular-validation/commit/18765a8dd986856a9fa176fc4835d90d25f663b2)`2015-03-29` Added new function of `checkFormValidity()` before submitting the form. Now use only 1 minified script instead of multiples.
421
-
*[1.3.11](https://github.com/ghiscoding/angular-validation/commit/e807584f0bcdf0f28ef2ef905b6bc4e890926ac1)`2015-03-30` Accepted pull request #15 to fix form without name attribute. Also accepted pull request #18 to add Spanish locales.
428
+
*[1.3.11](https://github.com/ghiscoding/angular-validation/commit/e807584f0bcdf0f28ef2ef905b6bc4e890926ac1)`2015-03-30` Accepted pull request #15 to fix form without name attribute. Also accepted pull request #18 to add Spanish locales.
429
+
*[1.3.12]()`2015-04-04` Fix issue #16 and added Validators Alternate Text option on all type of validators. Also fixed removeValidator and clean a lot of code.
0 commit comments