# Access Node "Name" property to use in a ui\_template

**URL:** <https://discourse.nodered.org/t/access-node-name-property-to-use-in-a-ui-template/1928>\
**Category:** Dashboard\
**Created:** [31 July 2018 13:14 UTC](https://discourse.nodered.org/t/access-node-name-property-to-use-in-a-ui-template/1928 "2018-07-31T13:14:49Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![tree-frog](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tree-frog/32/89303_2.png) [@tree-frog](https://discourse.nodered.org/u/tree-frog)\
**Post date:** [31 July 2018 13:14 UTC](https://discourse.nodered.org/t/access-node-name-property-to-use-in-a-ui-template/1928/1 "2018-07-31T13:14:50Z")

</div>

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?

Thanks,

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [31 July 2018 13:43 UTC](https://discourse.nodered.org/t/access-node-name-property-to-use-in-a-ui-template/1928/2 "2018-07-31T13:43:29Z")

</div>

There a whole separate category where the dashboard experts hang out... [https://discourse.nodered.org/c/dashboard](https://discourse.nodered.org/c/dashboard)

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [31 July 2018 13:45 UTC](https://discourse.nodered.org/t/access-node-name-property-to-use-in-a-ui-template/1928/3 "2018-07-31T13:45:05Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![tree-frog](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tree-frog/32/89303_2.png) [@tree-frog](https://discourse.nodered.org/u/tree-frog)\
**Post date:** [31 July 2018 17:52 UTC](https://discourse.nodered.org/t/access-node-name-property-to-use-in-a-ui-template/1928/4 "2018-07-31T17:52:18Z")

</div>

knolleary,  
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,

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [31 July 2018 18:55 UTC](https://discourse.nodered.org/t/access-node-name-property-to-use-in-a-ui-template/1928/5 "2018-07-31T18:55:09Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![tree-frog](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tree-frog/32/89303_2.png) [@tree-frog](https://discourse.nodered.org/u/tree-frog)\
**Post date:** [31 July 2018 19:26 UTC](https://discourse.nodered.org/t/access-node-name-property-to-use-in-a-ui-template/1928/6 "2018-07-31T19:26:44Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [31 July 2018 20:21 UTC](https://discourse.nodered.org/t/access-node-name-property-to-use-in-a-ui-template/1928/7 "2018-07-31T20:21:59Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![tree-frog](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tree-frog/32/89303_2.png) [@tree-frog](https://discourse.nodered.org/u/tree-frog)\
**Post date:** [1 August 2018 13:15 UTC](https://discourse.nodered.org/t/access-node-name-property-to-use-in-a-ui-template/1928/8 "2018-08-01T13:15:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![tree-frog](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tree-frog/32/89303_2.png) [@tree-frog](https://discourse.nodered.org/u/tree-frog)\
**Post date:** [1 August 2018 13:30 UTC](https://discourse.nodered.org/t/access-node-name-property-to-use-in-a-ui-template/1928/9 "2018-08-01T13:30:44Z")

</div>

dceejay,  
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.

---

<div class="post-metadata">

**Author:** ![shrickus](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/shrickus/32/517_2.png) [@shrickus](https://discourse.nodered.org/u/shrickus)\
**Post date:** [2 August 2018 16:28 UTC](https://discourse.nodered.org/t/access-node-name-property-to-use-in-a-ui-template/1928/10 "2018-08-02T16:28:26Z")

</div>

You can use any [Angular directives](https://docs.angularjs.org/api/ng/directive/ngIf) to avoid displaying html elements when certain conditions exist -- e.g.

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

```

---

<div class="post-metadata">

**Author:** ![tree-frog](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tree-frog/32/89303_2.png) [@tree-frog](https://discourse.nodered.org/u/tree-frog)\
**Post date:** [2 August 2018 19:05 UTC](https://discourse.nodered.org/t/access-node-name-property-to-use-in-a-ui-template/1928/11 "2018-08-02T19:05:53Z")

</div>

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.
