Hi, I have some global variables set.
Like sun.rise. Seems to be in the context data.
I'd like to retrieve them and use them in a dashboard template, or in a function that is crafted to output to a template.
I've named the variables in a function node:
var sunSign = global.get('sun.sign');
var sunRise = global.get('sun.rise');
var sunSet = global.get('sun.set');
var moonSign = global.get("moon.sign");
var moonPhase = global.get("moon.phase");
var moonRise = global.get('moon.rise');
var moonSet = global.get('moon.set');
var moonIco = global.get('moon.ico');
Example wish of combined text and variable:
The sun (global.sun.glyph) is in (global.sun.sign)
Sunrise-icon (global.sun.rise)
Sunset -icon (global.sun.set)
(global.moon.phase) (global.moon.ico) in (global.moon.sign)
I'd like to use them in a paragraph like the above.
Any direction on how to construct something like this would be super helpful.
One template node doing the work and one template dashboard UI showing it in the dashboard.
I'm making use of the node-red-contrib-astrodata for the data if you're curious.
Template node :
The sun is in {{global.sun.sign}}<br />
Rise {{global.sun.rise}}<br />
Set {{global.sun.set}}<br />
{{global.moon.phase}} in {{global.moon.sign}}<br />
Rise {{global.sun.rise}}<br />
Set {{global.sun.set}}<br />
This is the payload: <br />
{{payload}} if you're into that sort of thing.
Template UI ( Dashboard ) Node:
<div ng-bind-html="msg.payload"></div>
( just out putting the previous template, right? )
Final output for the dashboard:
The sun is in Aries<br />
Rise 6:41 am<br />
Set 7:26 pm<br />
Increasing moon in Virgo<br />
Rise 6:41 am<br />
Set 7:26 pm<br />
This is the payload: <br />
[object Object] if you're into that sort of thing.
][
Now I'm noticing that I'm not able to wrap the template info in a span for styling.
I'm able, but it's not showing the style on the dashboard as it is with other elements.
Surely I can add a little style in the template? But why doesn't it display styled in the dashboard? Huh?
I guess I'm still looking for a way to write styled html while plugging in data {{global.sun.set}} here and there.