diff --git a/src/Umbraco.Web.UI.Client/src/common/services/contenteditinghelper.service.js b/src/Umbraco.Web.UI.Client/src/common/services/contenteditinghelper.service.js index a85cc8024c..03fd6b2946 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/contenteditinghelper.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/contenteditinghelper.service.js @@ -55,8 +55,19 @@ function contentEditingHelper($location, $routeParams, notificationsService, ser for (var p in allOrigProps) { var newProp = getNewProp(allOrigProps[p].alias); if (newProp && !_.isEqual(allOrigProps[p].value, newProp.value)) { + //they have changed so set the origContent prop to the new one + var origVal = allOrigProps[p].value; allOrigProps[p].value = newProp.value; + + //instead of having a property editor $watch their expression to check if it has + // been updated, instead we'll check for the existence of a special method on their model + // and just call it. + if (angular.isFunction(allOrigProps[p].onValueChanged)) { + //send the newVal + oldVal + allOrigProps[p].onValueChanged(allOrigProps[p].value, origVal); + } + changed.push(allOrigProps[p]); } } diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/urllist/urllist.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/urllist/urllist.controller.js index 6dcd33847a..24a754b4f5 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/urllist/urllist.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/urllist/urllist.controller.js @@ -12,12 +12,11 @@ angular.module('umbraco').controller("Umbraco.Editors.UrlListController", formatDisplayValue(); - //we need to put a watch on the real model because when it changes we have to update our renderModel - $scope.$watch("model.value", function (newVal, oldVal) { - if (newVal !== null && newVal !== undefined && newVal !== oldVal) { - //update the display val again - formatDisplayValue(); - } - }); + //here we declare a special method which will be called whenever the value has changed from the server + //this is instead of doing a watch on the model.value = faster + $scope.model.onValueChanged = function(newVal, oldVal) { + //update the display val again + formatDisplayValue(); + }; }); \ No newline at end of file