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

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.

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

thank you, now I fix it!