How to program a if-instruction in the template node by using html

#1

Hello,

I got a problem with my template node. in this node I load a Picture in the Dashboard.
Now I want the picture to change when the payload changes too. Unfortunately I have no idea how to do this.

0 Likes

#2

If you want to render an html element based on some msg.payload data, you can use a ui_template node. For instance, assuming you can have a relative url string in your payload, you can insert it into an <img> src attribute using this syntax:

<img style="width: 300px; height: 200px;" src="{{msg.payload}}">

Every time a new payload arrives, the image src is updated, and the new image appears on the dashboard (or a broken image icon, if the url is not valid).

1 Like

#3

thank you, now I fix it!

0 Likes