Skip to content

Commit d106996

Browse files
committed
Added support to Angular 1.3.x
- Support Angular 1.3.x - Moved previous validation file to legacy folder - Updated Angular-Translate so it work properly with Angular 1.3.x
1 parent f4e263c commit d106996

File tree

8 files changed

+622
-13
lines changed

8 files changed

+622
-13
lines changed

angular-validation.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* angular-validation - v1.1 - 2014-05-02
2+
* angular-validation - v1.3 - 2014-12-01
33
* https://github.com/ghiscoding/angular-validation
44
* @author: Ghislain B.
55
*
@@ -9,6 +9,8 @@
99
*
1010
* Version 1.1: only start validating after user inactivity,
1111
* it could also be passed as an argument for more customization of the inactivity timeout (typing-limit)
12+
*
13+
* Version 1.3: support to Angular 1.3.x
1214
*/
1315
angular.module('ghiscoding.validation', ['pascalprecht.translate'])
1416
.directive('validation', function($translate, $timeout) {
@@ -481,13 +483,13 @@
481483

482484
// invalidate field before doing any validation
483485
if(isFieldRequired) {
484-
ctrl.$setValidity('validation', false); // this breaks with AngularJS 1.3 as it return invalid field
486+
ctrl.$setValidity('validation', false);
485487
}
486488

487489
// onBlur make validation without waiting
488490
elm.bind('blur', function() {
489491
// make the regular validation of the field value
490-
scope.$apply(ctrl.$setValidity('validation', validate(value) ));
492+
scope.$evalAsync(ctrl.$setValidity('validation', validate(value) ));
491493
return value;
492494
});
493495

@@ -506,7 +508,7 @@
506508
updateErrorMsg("");
507509
$timeout.cancel(timer);
508510
timer = $timeout(function() {
509-
scope.$apply(ctrl.$setValidity('validation', validate(value) ));
511+
scope.$evalAsync(ctrl.$setValidity('validation', validate(value) ));
510512
}, typingLimit);
511513
}
512514

index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ <h3 class="text-info">{{'CHANGE_LANGUAGE' | translate}}</h3>
2222
<ng-view></ng-view>
2323

2424
<!-- external librairies CDN -->
25-
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.12/angular.js"></script>
26-
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.12/angular-route.js"></script>
25+
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.4/angular.js"></script>
26+
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.4/angular-route.js"></script>
2727

2828
<!-- angular-translate -->
2929
<!-- Visit Angular-Translate https://github.com/PascalPrecht/angular-translate -->

0 commit comments

Comments
 (0)