Ontouchstart / ng-Touchstart / UI-template

Hello Guys.

I'm new in the node red game.
I'm currently have problems with an angular js directive. I tried to install and make ngtouch work, but without luck.
I also tried angular-gestures, no luck eighter.

Then i managed to get ontouchstart to fire a function when clicking a md-button. The problem is that ontouchstart is not a angularjs directive, thus it will not update my callback function and send a new msg.payload.

I would like to send 1 or 0 as my payload message. touchstart should send 0, and touch end should send 1. How do i fix this?

Here is what i have so far.

<md-button
ontouchstart="send({payload:mdown()})"
ontouchend="send({payload:mup()})">
</md-button>

<script>
var value = "hello world";
this.scope.mdown = function() { return "0" }
this.scope.mup = function() { return "1" }
</script>

I really need some help here.

Best Regards

ngTouch is already built in but only adds swipe left and swipe right. ngClick handles the basic click and touch.

But i need a ngTouchstart + ngtouchend, or touchpressed? How do i do that?

Please don't "bump" the thread every two hours. If someone knows the answer when they read the forum they will post an answer

1 Like

I managed to find a way around the problem. I used jQuery to "simulate" mousedown and mouseup. Now it works.

2 Likes

hello!
Can I have the answear? I have the same problem..

+1
could you please share your solution?

Really keen to know the answer here - I have the same frustrating problem

My similar code issue is below which passes the a string to the exec node on the RPI when the button is pressed, and when it is released..:

<script>
    this.scope.mdown = function() { return "python /home/pi/....turn something on"; }
    this.scope.mup = function() { return "python /home/pi/....turn something off"; }
</script>
<md-button 
    ng-touchend   = "send({payload:mup()})"
    ng-touchstart = "send({payload:mdown()})"
>
My Action Button
</md-button>

Try the following solution: Momentary button on Dashboard

1 Like

:grinning: worked very well! Thank you!

2 Likes