Skip to content

Commit 8c0818d

Browse files
committed
Schema validation fix for Angular 1.2 ($setDirty)
I am required to support IE8 and am therefore limited to Angular JS 1.2 I am sure you would make this fix in time, but I have deadlines! :-) The Angular 1.2 version of $setDirty taken from http://makandracards.com/makandra/29625-setdirty-for-angular-1-2
1 parent 3255b40 commit 8c0818d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/directives/schema-validate.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,12 @@ angular.module('schemaForm').directive('schemaValidate', ['sfValidator', 'sfSele
6363

6464
// Listen to an event so we can validate the input on request
6565
scope.$on('schemaFormValidate', function() {
66-
// FIXME: Try to make a fix for angular 1.2
67-
if (ngModel.$setDirty()) {
66+
if (ngModel.$setDirty) {
67+
// Angular 1.3+
6868
ngModel.$setDirty();
69+
} else {
70+
// Angular 1.2
71+
ngModel.$setViewValue(ngModel.$viewValue);
6972
}
7073
validate(ngModel.$viewValue);
7174
});

0 commit comments

Comments
 (0)