From 6e830c11717b6866997de95bc526b27664a123d3 Mon Sep 17 00:00:00 2001 From: Robert Date: Wed, 10 Jan 2018 10:03:02 +0100 Subject: [PATCH] Wrapping the watch in the elm.focus Seems to bring the watch calls way down. --- .../directives/validation/nodirtycheck.directive.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/validation/nodirtycheck.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/validation/nodirtycheck.directive.js index ede35022fc..c4a273243e 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/validation/nodirtycheck.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/validation/nodirtycheck.directive.js @@ -10,10 +10,14 @@ function noDirtyCheck() { require: 'ngModel', link: function (scope, elm, attrs, ctrl) { - scope.$watch(function () { - ctrl.$pristine = false; + elm.focus(function () { + scope.$watch(function() { + ctrl.$pristine = false; + console.log("here"); + }); }); + } }; }