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: readme.md
+8-20Lines changed: 8 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,14 +2,14 @@
2
2
### Form validation after user inactivity (customizable timeout)
3
3
`Version: 1.3.4`
4
4
5
-
Angular Validation made easy! Angular Validation is an angular directive with locales (languages) with a simple approach of defining your validation="" directly within your element to validate (input, textarea, etc) and...that's it!!! The directive will take care of the rest!
5
+
Angular Validation made easy! Angular Validation is an angular directive with locales (languages) with a simple approach of defining your `validation=""` directly within your element to validate (input, textarea, etc) and...that's it!!! The directive will take care of the rest!
6
6
7
7
The base concept is not new, it comes from the easy form input validation approach of Laravel Framework as well as PHP Gump Validation. They both are built in PHP and use a very simple approach, so why not use the same concept over Angular as well? Well now it is available and with some extras.
8
8
9
-
For a smoother user experience, I also added validation on inactivity (timer). So validation will not bother the user while he is still typing...though as soon as user makes a pause for a certain amount of time, then validation comes in play. This feature is only while typing, if user is focusing out of the input (onBlur) it will validate instantly.
9
+
For a smoother user experience, I also added validation on inactivity (timer). So validation will not bother the user while he is still typing... but as soon as the user makes a pause for a certain amount of time, then validation comes into play. This feature is only while typing, if user is focusing out of the input (onBlur) it will validate instantly.
10
10
11
11
Now also supporting AngularJS 1.3.x
12
-
*current code should work with 1.2.x just the same*
12
+
*current code should work with 1.2.x just the same but is no more verified*
13
13
14
14
## Live Demo
15
15
[Plunker](http://plnkr.co/jADq7H)
@@ -18,7 +18,7 @@ Now also supporting AngularJS 1.3.x
18
18
## Requirements
19
19
Angular-Validation requires the element that will use validation to have a `name=""` attribute, so that it can use this name to associate a `<span>` for error displaying. For example: `<input name="input1" ng-model="input1" validation="validator1" />`.
20
20
21
-
*The necessity of `name=""` attribute is new since version 1.3.4+, prior to this change we were asking the user to create his own `<span>` for error displaying. To make it more clear, the `<span>` is now optional, but the `name=""` attribute becomes mandatory and will throw an error if omitted*
21
+
*The necessity of `name=""` attribute is new since version 1.3.4+, prior to this change we were asking the user to create his own `<span>` for error displaying. For a better understanding, the `<span>` is now optional, but the `name=""` attribute becomes mandatory and will throw an error if omitted*
22
22
23
23
24
24
## Some Working Examples
@@ -131,18 +131,6 @@ Step #1-4 are for explanation only, at the end we show the full regex (make sure
131
131
Final code (no spaces): `regex:YYWW:=^(0[9]|1[0-9]|2[0-9]|3[0-9])(5[0-2]|[0-4][0-9])$:regex`
132
132
133
133
134
-
Validation Event (default: keyup)
135
-
--------------------
136
-
We could also specify whichever validation event we want to trigger the validation (keyup, blur, etc...).
137
-
138
-
Features:
139
-
140
-
1. All possible events of the element are accepted `keyup`, `blur`, etc...
141
-
142
-
2. Event could be written with/without the `on` as prefix. `onblur` is equivalent to `blur`.
143
-
144
-
3. Default event `keyup` can be changed in the directive itself via constant `DEFAULT_EVENT`
145
-
146
134
Locales (languages)
147
135
--------------------
148
136
Locales are simply sets of language defined in external JSON files, we can easily add any new language as extra files without affecting the behaviour of the angular directive. You could even change displayed language on the fly, well of course the error message will be reflected only after field value is re-evaluated. You of course have to include the `angular-translate` library and configure it, see section [Include it in your Project](#project)
@@ -154,7 +142,7 @@ Note: To be fully localized, I should add the country code at the end of my JSON
154
142
var key ='fr';
155
143
156
144
$scope.switchLanguage=function (key) {
157
-
$translate.uses(key);
145
+
$translate.use(key);
158
146
};
159
147
```
160
148
@@ -208,7 +196,7 @@ Include it in your app project:
208
196
--------------------
209
197
```javascript
210
198
// include it your app module ( we need both Translate & Validation)
211
-
var myApp =angular.module('myApp', ['ngRoute', 'pascalprecht.translate', 'ghiscoding.validation']);
199
+
var myApp =angular.module('myApp', ['ngRoute', 'ghiscoding.validation', 'pascalprecht.translate']);
212
200
213
201
// include validation languages
214
202
// if you want full localization add it in the suffix
*[1.3.3](https://github.com/ghiscoding/angular-validation/commit/7b3043a97006a3d7043b198f89c91f8b6c49476e)`2015-01-04` Added changelog & updated Bootstrap(3.3.1), AngularJS(1.3.7) to latest versions
249
237
*[1.3.4](https://github.com/ghiscoding/angular-validation/commit/ba30d55ddb8bca44a8032fc8253356450bd4e1d4)`2015-01-06` Removed the necessity of creating a `<span>` for displaying the error message, the directive now handles it by itself.
250
238
*[1.3.5](https://github.com/ghiscoding/angular-validation/commit/679b24ca4daee8419731c45d1d65d63cb5ca74a5)`2015-01-26` Throw an error message when user did not provide a `name=""` property inside the element to validate.
251
-
*[1.3.6]()`2015-02-09` Added `ng-strict-di` for minification, renamed some files and folder lib to `/vendors`, moved directive into new `/src` folder for better separation.
239
+
*[1.3.6](https://github.com/ghiscoding/angular-validation/commit/e47e91f45f93a3f191ab6849d06163563674e9e2)`2015-02-09` Added `ng-strict-di` for minification, renamed some files and folder lib to `/vendors`, moved directive into new `/src` folder for better separation.
0 commit comments