Change Dashboard side on click on image

#1

So I managed to show an image on the dashboard using a template node andnthe following code

<div height="200" style="height: 200px;">
<img src="/Block_Gray.png" width="140"><br/>
</div>

Now I want to send a number to a ui control node, when the image is clicked. I already tried the following line

<a href="" class="off" onclick="this.className='on';return false;">Foo</a>
Does somebody have a hint for me?

0 Likes

#2

The hint you need is the ‘Sending a message’ section of the ui_template node’s help in the Info sidebar.

0 Likes

#3

I saw the Sending a message section, but this creates an extra button under the image, that needs to be clicked. I don’t want to creat a button, I wnat to capture if the image is clicked.

0 Likes

#4

Understood, but the principle is the same. That section shows how to trigger a message when something happens using the ng-click attribute.

Applying that to your <div>

<div height="200" style="height: 200px;" ng-click="send({payload:'clicked'});">
<img src="/Block_Gray.png" width="140"><br/>
</div>
0 Likes

#5

Thanks, worked for me

0 Likes