Skip to content

Instantly share code, notes, and snippets.

@gbrault
Last active July 19, 2016 11:36
Show Gist options
  • Save gbrault/af65a0455a87755151ee4c7509415b02 to your computer and use it in GitHub Desktop.
Save gbrault/af65a0455a87755151ee4c7509415b02 to your computer and use it in GitHub Desktop.
How to call functions or watch variables in NODE-RED UI (angular.js)
<script>
(function(scope) {
scope.name = "Here I am!!!";
/* scope.fun = function(val){alert(val);return val}; */
scope.$watch('msg.payload', function(newValue, oldValue) {
/* Do something clever here */
if(!angular.equals(newValue, oldValue)){
alert(newValue);
}
});
})(scope)
</script>
{{name+" "+msg.payload}}
<!-- {{fun(name)}} -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment