# UI Template ng-click binding msg to ng-click to send

**URL:** <https://discourse.nodered.org/t/ui-template-ng-click-binding-msg-to-ng-click-to-send/86813>\
**Category:** Dashboard\
**Created:** [27 March 2024 19:04 UTC](https://discourse.nodered.org/t/ui-template-ng-click-binding-msg-to-ng-click-to-send/86813 "2024-03-27T19:04:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mick](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mick/32/80990_2.png) [@Mick](https://discourse.nodered.org/u/Mick)\
**Post date:** [27 March 2024 19:04 UTC](https://discourse.nodered.org/t/ui-template-ng-click-binding-msg-to-ng-click-to-send/86813/1 "2024-03-27T19:04:08Z")

</div>

I am trying to bind an input msg to my Ui template so that I can send it via ng-click. So far it has eluded me. I have tried scope.$watch and can create the variable but ng-click is not sending it. Here is my flow:

```auto
[{"id":"b65ae12fe1bd23ef","type":"function","z":"c6c8b7c140027b58","name":"checkRadio2","func":"const radio = env.get(\"radio2\");\nconst radios = global.get('radios')\nconst is6700 = radios.filter(checkradio2).toString();\n\nfunction checkradio2(data) {\n return data == radio\n}\n\nif (global.get('radio2_On') === false) {\n return { payload: `${radio} Not Available`, radio: radio, style: 'rounded-off' }\n} \nif (global.get('radio2_On') === true) {\n if (radios.length === 0 ){\n return { payload: `${radio} Available`, radio: radio,style: 'rounded' }\n }\n if (is6700 != radio && (global.get('connected') != '-XX-')) {\n return { payload: `${radio} Available`, radio: radio,style: 'rounded' }\n }\n if (is6700 === radio && (global.get('connected') === '-XX-')) {\n return { payload: `Select ${radio}`, radio: radio, style: 'rounded-available' }\n }\n if (is6700 === radio && (global.get('connected') === '6400')) {\n return { payload: `Select ${radio}`, radio: radio, style: 'rounded-available' }\n }\n if (is6700 === radio && (global.get('connected') === radio)) {\n return { payload: `${radio} Connected`, radio: radio, style: 'rounded-on' }\n }\n}","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":870,"y":300,"wires":[["2476ba3d7fac5f7d","353fd417455e6174","38532a90b75bd99c"]]},{"id":"2476ba3d7fac5f7d","type":"ui_template","z":"c6c8b7c140027b58","group":"b914eca7a788b208","name":"6600","order":4,"width":2,"height":1,"format":"\n<md-button class=\"vibrate filled touched smallfont {{msg.style}}\" title= \"Click to select radio\"\n ng-click=\"send({payload=msg.RADIO})\">\n {{msg.payload}} <br/>\n</md-button>","storeOutMessages":false,"fwdInMessages":false,"resendOnRefresh":false,"templateScope":"local","className":"","x":1010,"y":300,"wires":[["3c39b7153a51f355","7c1f866cefe125b8"]]},{"id":"3c39b7153a51f355","type":"function","z":"c6c8b7c140027b58","name":"bindRadio2","func":"if (msg.payload === '6600 Selected'){\n if (global.get('connected') === '6400') { // set value to other radio from nickname\n node.send( [[],[{payload: false}]])\n await new Promise(r => setTimeout(r, 2000));\n return [[{ payload: '6600' }], []]\n }\n if (global.get('connected') === '-XX-') {\n return [[{payload: '6600'}],[]]\n } else\n return [[{ payload: '6600' }], []]\n} ","outputs":2,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":1150,"y":300,"wires":[["0ad9adc87cd8414c"],["a6815003999a3ef9"]]},{"id":"b914eca7a788b208","type":"ui_group","name":"Radios","tab":"d8a12855.a756b8","order":1,"disp":false,"width":"4","collapse":false,"className":""},{"id":"d8a12855.a756b8","type":"ui_tab","name":"Station","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

```

Thank you in advance.

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [27 March 2024 19:33 UTC](https://discourse.nodered.org/t/ui-template-ng-click-binding-msg-to-ng-click-to-send/86813/2 "2024-03-27T19:33:51Z")

</div>

Typo in ng-click  
`ng-click="send({payload=msg.RADIO})"`  
should be  
`ng-click="send({payload:msg.RADIO})"`

---

<div class="post-metadata">

**Author:** ![Mick](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mick/32/80990_2.png) [@Mick](https://discourse.nodered.org/u/Mick)\
**Post date:** [27 March 2024 19:46 UTC](https://discourse.nodered.org/t/ui-template-ng-click-binding-msg-to-ng-click-to-send/86813/3 "2024-03-27T19:46:03Z")

</div>

Thank you.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [10 April 2024 19:46 UTC](https://discourse.nodered.org/t/ui-template-ng-click-binding-msg-to-ng-click-to-send/86813/4 "2024-04-10T19:46:26Z")

</div>

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