Sending msg.payload inside template function


#1

Hi All.

I'm using a dashboard template to make some buttons. Each button fires an simple function inside the template.
I have problems sending a msg.payload from the function.

I can't use the predefined ng-click. Here is what i have so far:

 <button
 ontouchstart="touchFuncttion(0)"
 ontouchend="touchFunction(1)">
 </button>
 
 <script>
 var Q = 1;
 function touchFunction(Q) {
 if (Q===0){
 send something to msg.payload;
 }
 else if (Q===1) {
 send something else to msg.payload;
 }
 }
 </script>

Any one who knows how to do this? :slight_smile:

Best Regards Bastian


#2

Have you read the help provided with the ui_template node in the Info sidebar? It has a section on how to send messages.


#3

Hi There.

I have read it again and again. The problem is that it uses ng-click to fire this.scope.action. I can't use the predefined ng-directives because it has poor touchsupport. So basically I need to send an msg.payload inside a function in the template.

Best Regards


#4

Maybe this could be helpful