<div id="{{'my_'+$id}}" style="{{'color:'+theme.base_color}}">Some text</div>
<script>
(function(scope) {
scope.$watch('msg', function(msg) {
if (msg) {
// Do something when msg arrives
$("#my_"+scope.$id).html(msg.payload);
}
});
})(scope);
</script>
I do not understand where the $id variable comes from or what it is. A google search revealed nothing for me. Reading the node red help online also led nowhere. I am missing something fundamental. Any pointers would be most appreciated.
Just for my own peace of mind, as I understand it scope.$id generates its own value, which is then used as the $id in "{{'my_'+$id}}" and trying to use scope.$id and $id in the body without the moustache is a bad idea.
@Steve-Mcl thank you for that. So this is Angular then is it? I am very new to node-red and unfamiliar with Angular. Are you able to point me to any resources for learning about how Angular works together with node red? I was unable to find anything much on the node red documentation website.
Although I have been a programmer for forty years (!) I have never used Angular - believe it or not.
No, to be clear this is angularjs. angular is the successor of angularjs .
I am not an expert in angularjs (or angular for that matter) but there is tonnes of info around the net. Just be sure whatever tutorials or sample code you read/use is angularjs.