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
@@ -17,4 +17,5 @@ Angular-Validation change logs
17
17
1.3.13 (2015-04-06) Fixed $translate delay issue when using external JSON files
18
18
1.3.14 (2015-04-07) Merge pull request #19 Added norwegian translation and changes to allow user to remove invalid validators.
19
19
1.3.15 (2015-04-08) Fixed #23 If multiple forms exist in the app the errors in 1 form affect validation in the other
20
-
1.3.16 (2015-04-09) Accept Merge #3 Fixed removeFromValidationSummary to also remove from 'local' array
20
+
1.3.16 (2015-04-09) Accept Merge #3 Fixed removeFromValidationSummary to also remove from 'local' array
21
+
1.3.17 (2015-04-11) Added global `$scope.$validationOptions` object, for now only has the `debounce` property that be used by both the Directive and Service.
Copy file name to clipboardExpand all lines: readme.md
+38-2Lines changed: 38 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
#Angular Validation (Directive / Service)
2
-
`Version: 1.3.16`
2
+
`Version: 1.3.17`
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!
@@ -16,6 +16,8 @@ Huge rewrite to have a better code separation and also adding support to Service
16
16
17
17
[Validation summary](#validation-summary) was also recently added to easily show all validation errors that are still active on the form and you can also use 2 ways of dealing with the [Submit](#submit) button.
18
18
19
+
For more explanations, see the question answered: [Why Use It?](#whyuseit)
20
+
19
21
<aname="plunker"></a>
20
22
## Live Demo
21
23
[Plunker](http://plnkr.co/jADq7H)
@@ -29,6 +31,7 @@ Huge rewrite to have a better code separation and also adding support to Service
29
31
*[Demo - Plunker](#plunker)
30
32
*[Dependencies](#dependencies)
31
33
*[Form Submit and Validation](#submit)
34
+
*[Global Options](#global-options)
32
35
*[Install (bower)](#install)
33
36
*[Include it in your app project](#project)
34
37
*[Locales (languages)](#locales)
@@ -37,6 +40,27 @@ Huge rewrite to have a better code separation and also adding support to Service
37
40
*[Some Working Examples (Directive)](#examples-directive)
38
41
*[Some Working Examples (Service)](#examples-service)
39
42
*[Validation summary](#validation-summary)
43
+
*[Why Use It?](#whyuseit)
44
+
45
+
<aname="whyuseit"></a>
46
+
Why use angular-validation?
47
+
-----
48
+
Angular-validation was develop with DRY (Don't Repeat Yourself) and simplicity in mind.
The Angular-Validation will create by itself the necessary error message. Now imagine your form with 10 inputs, using the Angular-Validation will end up using 10 lines of code, while on the other hand using the default of Angular will give you 30 lines of code... so what are you waiting for? Use Angular-Validation!!! :)
40
64
41
65
<aname="install"></a>
42
66
Install
@@ -98,6 +122,8 @@ Angular-Validation requires the element which will use validation to have an htm
98
122
Let's start with a simple example and then let's get down to real business.
99
123
100
124
P.S. For real live sample, see the [live plunker demo](#plunker) or download the Github project and run the `index.html` (on the exception of Chrome who doesn't want to run http outside of webserver) while the actual form with validation is inside `templates/testingFormDirective.html` for a better separation.
125
+
126
+
*To define the debounce globally (for all form elements), you could use `$scope.$validationOptions = { debounce: 1500 };` or set it on each element `<inputdebounce="1500"/>*
101
127
```html
102
128
<!-- example 1 -->
103
129
<!-- change the debounce or typing-limit (timer in ms of inactivity) after which will trigger the validation check -->
@@ -186,6 +212,15 @@ P.S. For real live sample, see the [live demo](#plunker) or download the Github
186
212
};
187
213
188
214
```
215
+
<aname="global-options"></a>
216
+
## Global Options
217
+
To change default options, you can change the `$scope.$validationOptions`, for now only the `debounce` property is used but this might expend in the future.
218
+
To define the debounce globally (for all form elements), you could use `$scope.$validationOptions = { debounce: 1500 };` or set it on each element `<inputdebounce="1500"/>
219
+
```javascript
220
+
myApp.controller('Ctrl', function ($scope) {
221
+
$scope.$validationOptions= { debounce:1500 }; // set the debounce globally
222
+
});
223
+
```
189
224
190
225
<aname="submit"></a>
191
226
## Form Submit and Validation
@@ -461,4 +496,5 @@ License
461
496
*[1.3.13](https://github.com/ghiscoding/angular-validation/commit/d0440bdd7fc2816e03d28ad3a9c3bd7bee8ac519)`2015-04-06` Fixed $translate delay issue when using external JSON files
462
497
*[1.3.14](https://github.com/ghiscoding/angular-validation/pull/19)`2015-04-07` Merge pull request #19 Added norwegian translation and changes to allow user to remove invalid validators
463
498
*[1.3.15](https://github.com/ghiscoding/angular-validation/commit/24037e4b2e22658e7e2011c022ba4cca26f391d9)`2015-04-08` Fixed #23 If multiple forms exist in the app the errors in 1 form affect validation in the other
464
-
*[1.3.16]()`2015-04-09` Accept Merge #3 Fixed removeFromValidationSummary to also remove from 'local' array
499
+
*[1.3.16](https://github.com/ghiscoding/angular-validation/commit/6c419d45bdb00341416d91199003d827259bd5da)`2015-04-09` Accept Merge #3 Fixed removeFromValidationSummary to also remove from 'local' array
500
+
*[1.3.17]()`2015-04-11` Added global `$scope.$validationOptions`[Global Options](#global-options) object, for now only has the `debounce` property that be used by both the Directive and Service.
varbFieldRequired=false;// by default we'll consider our field not required, if validation attribute calls it, then we'll start validating
17
17
varINACTIVITY_LIMIT=1000;// constant of maximum user inactivity time limit, this is the default cosntant but can be variable through typingLimit variable
@@ -26,8 +26,6 @@ angular
26
26
varvalidators=[];// Array of all Form Validators
27
27
varvalidatorAttrs={};// Current Validator attributes
// get the name attribute of current element, make sure to strip dirty characters, for example remove a <input name="options[]"/>, we need to strip the "[]"
0 commit comments