How to dynamically set HTML attribute value using UI template mustache syntax?

I've tried to set dynamically UI template button onclick attribute value using mustache syntax (myfunction is intended to be executed in browser). I've got parse syntax error, any hints ?

Function node:

msg.my_onclickfunction = "myfunction()";
msg.my_onclickfunction = "\"myfunction()\"";
return msg;

UI Template node (HTML):

`<button id="myid" class="myclass" onclick={{msg.my_onclickfunction}}></button>`


msg.my_onclickfunction = "myfunction()";



Then use browser Devtools to inspect.

Ps: no idea if it will actually work.

What are you trying to achieve? What is the end goal?

Thank's Steve, unfotunately no joy ...

Function node
msg.my_onclickfunction = "myfunction()";

UI template node
i've got parse error with Devtools on:
<button onclick="{{{msg.my_onclickfunction}}}"></button>

Error: $parse:syntax
Syntax Error
Syntax Error: Token '.' is unexpected, expecting [}] at column 5 of the expression [{msg.my_onclickfunction] starting at [.my_onclickfunction].

and compile error on alternative:
<button onclick={{msg.my_onclickfunction}}></button>

Error: $compile:nodomevents
Event Attribute/Property Binding
Interpolations for HTML DOM event attributes are disallowed

My goal is mainly to factorize UI templates (calling external javascript and css static ressources in browser) using only a subflow vs several statics ui templates.

Function node
msg.my_color = "color: green";
UI template node
<p style={{msg.my_color}}>my text</p>
OK and also
Function node
msg.my_id = "test";
UI template node
<button id={{msg.my_id}}></button>
is OK too !

i'm quite a newbie with node and vue but very impressed on NR capabilities. Any workaround to bind DOM events ?

If you are doing what I am thinking, there are issues putting UI nodes in a subflow (I forget what - but it doesnt work as expected)

Perhaps this is of some help - something i did some time back...

there are lots of hint and clues in there that might prove useful (like moving away from directly specifying colours - using classes instead, etc)

That shouldn't even get through to the browser. Share your code if you want someone to look closer.

Steve, i will look at your UI button management examples.
Difficult for me to share code now but i will try to clean it from "private" elements (logins, url's etc ..) and post here.

My current code (web radio player with metadata and covers) is quite functional for my use. I'm trying to factorize to enhance "maintenability". Thank's again for you help, i've a lot to learn.

PS: Also interested in Monaco editor :slightly_smiling_face: