# Using template node with if else condition

**URL:** https://discourse.nodered.org/t/using-template-node-with-if-else-condition/85176
**Category:** Dashboard
**Tags:** node-red-dashboard, function-node, javascript
**Created:** [4 February 2024 06:53 UTC](https://discourse.nodered.org/t/using-template-node-with-if-else-condition/85176 "2024-02-04T06:53:29Z")
**Posts on this page:** 1
**Showing post:** 6

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [5 February 2024 06:44 UTC](https://discourse.nodered.org/t/using-template-node-with-if-else-condition/85176/6 "2024-02-05T06:44:43Z")

</div>

Hi Kenneth. Glad to hear you got a solution. Always good as a learning experience.

For the benefit of future readers, this is original Dashboard-1 which uses the now unsupported angularjs (not the new Dashboard-2 which is Vue based)

The solution above is certainly one approach however there is a much simpler way. In the built in help of the template node, it mentions you can set the class dynamically via `msg.className`. So, instead, one could have prepared a CSS class that hides the image and simply updated the template via the msg (no angularjs scooped script required)

Here is a post I did some time ago that has more detail: [Dashboard Button Node - \</\>Class Field not working - #24 by Steve-Mcl](https://discourse.nodered.org/t/dashboard-button-node-class-field-not-working/52651/24)

---

_[View the full topic](https://discourse.nodered.org/t/using-template-node-with-if-else-condition/85176)._
