Change my button background color

Hi, I like to change my background color of my button on a dashboard, depending of the state of a global variable.
It has to look like => {{global.get("speelOverhevel" ) == true? 'green' : 'red'}} But that is not working.

If I put something like this => {{msg.payload.state >0? 'green' : 'red'}} this is working. But I like to use my global variable.

Is there somebody who can point me in the right direction?
Thanks.

Guessing as you have not supplied a example flow.

You are trying to use angular {{ }}
But global is server side and angular is client side, so is not available in the button, which is running in your browser (client side)

Use a change node prior to the button to set a property of msg to the value of the global var.

If this is not correct please supply an simple example flow of issue.

1 Like

Thanks this is working.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.