Access Node "Name" property to use in a ui_template


I'm using ui_templates to set color background to text boxes. They also have a label which I would like to use the "Name" property of the node to display the label for easy setup and since the name is a blank in the ui_template configuration. It should be easy to access the Name" property, and then reference in the HTML. I looked but I cannot quite get the syntax to use. Can someone please help who knows how?




There a whole separate category where the dashboard experts hang out...



The template inside a ui_template node does not have access to the node's name property.

(Note I have moved this topic over to the dashboard category that @ukmoose pointed at)



Since the ui_template has no access, it's pointless to try and use the name as an internal reference to the label on the HTML object.... Is there a means in the future to allow access to this information in order to facilitate something like this for setup/configuration purposes?

Kind Regards,



The node (and it’s properties like name) are on the server side. The ui_template and other ui_ elements are browser side. Maybe you could add an id to the template that css could find ?



i tried to access with a function, but the syntax I'm using is not right. I believe I need to upgrade to '0.19'. I'm on '0.18' currently.. according to the doc it can access it but my older version cannot?



In the 0.19 release the Function node will have access to its name property. 0.19 will be released in a couple weeks when Dave and I are both back from holiday.

But that is the Function node accessing its name property. That has nothing to do with the ui_template node accessing its name property.



OK, thanks. I appreciate your time and effort to explain this.



I believe you have something there. I was locked into a thought that these should be constants... Actually it would serve me better if I did as you suggest and send these in the message. That way the values can be dynamic and the display can morph somewhat as products change and the needs for added display items change.

Is there an easy way to make an element not display if it does not have data to match the widget? i.e. loop around areas of HTML to avoid displaying it altogether? It appears that once these are defined they display as per configuration. I have noticed that a test ui_template has affected the display even if there was no message connection to it.



You can use any Angular directives to avoid displaying html elements when certain conditions exist -- e.g.

<img src='go.png' ng-if="msg.payload == 0"></img>
<img src='stop.png' ng-if="msg.payload == 1"></img>
1 Like


Thanks shrickus,

I'll take a closer look at this. It looks like I need an education on Angular. I had no idea how to do any conditional statements in HTML/CSS, or if it was even possible.