I use HTML to format Value Format and Label of UI-nodes. F. e.
<font color = {{msg.color}} >Hallo</font>
msg.color is defined right before the ui-node in the corresponding flows.
I thought, I could globally set my color scheme and re-utilize it with global variables. However,
<font color = {{global.color_x}} >Hallo</font>
isn't recognized. The text is standard white. The same applies if I used global.get("color_x") or global.get('color_x') instead of global.color_x.
I could not find any hint whether this approach in general isn't possible in relation to HTML. Everywhere else I can access global variables in function nodes or ...
Hi @jodelkoenig,
When you inject a msg into a UI template node, that msg is pushed to the dashboard. So you can use the msg properties like in your example.
However the Node-RED (node/flow/global) memory context is only available on the server side flow. So it is normal that you can access those properties e.g. in a function-node, since the JS code (which you have entered inside the function node) is running on the server. But you don't have that data available in the dashboard.
Bart
Thanks @TotallyInformation. I know I can or better should do the same via CSS or style attributes. The solution with < font color >, however, was easy enough for me to grasp and implement at the time I started with nodered. I think, I should dig a bit into it
I see and understand now, why global context is not working here, @BartButenaers . Thanks for your explanation. It makes sense