From 8c0818da5d9df02786bdd520acd3d731ef3d5f8a Mon Sep 17 00:00:00 2001 From: Adam Buckley Date: Mon, 9 Mar 2015 15:49:26 +0000 Subject: [PATCH] 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 --- src/directives/schema-validate.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/directives/schema-validate.js b/src/directives/schema-validate.js index e5d8d940b..7f3245f13 100644 --- a/src/directives/schema-validate.js +++ b/src/directives/schema-validate.js @@ -63,9 +63,12 @@ angular.module('schemaForm').directive('schemaValidate', ['sfValidator', 'sfSele // Listen to an event so we can validate the input on request scope.$on('schemaFormValidate', function() { - // FIXME: Try to make a fix for angular 1.2 - if (ngModel.$setDirty()) { + if (ngModel.$setDirty) { + // Angular 1.3+ ngModel.$setDirty(); + } else { + // Angular 1.2 + ngModel.$setViewValue(ngModel.$viewValue); } validate(ngModel.$viewValue); });