Created
February 23, 2018 08:28
-
-
Save mattbrailsford/7eed108850c2858588e0245f0320fb2a to your computer and use it in GitHub Desktop.
Example Umbraco property editor code for writing to the model.value and listening for changes without using an angular watcher
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//here we declare a special method which will be called | |
// whenever the value has changed from the server | |
$scope.model.onValueChanged = function (newVal, oldVal) { | |
// Model value changed so update UI | |
updateUi() | |
}; | |
var unsubscribe = $scope.$on("formSubmitting", function () { | |
// Write data back to the model.value | |
$scope.model.value = ... | |
}); | |
$scope.$on('$destroy', function () { | |
unsubscribe(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment