Trigger release()

Hello guys,

I’m trying to do something with onDrag, detecting the delta, and after 30px I want to trigger the release event - simulate the user released his finger. I tried this :

$scope.onDragUp = function(event) {
    if(event.gesture.deltaY < -30) {
        $scope.slideTo('formLog', 'formReg');
        ionic.EventController.trigger('release', {target: event.srcElement});
    }
};

But it doesn’t work, and adds a bunch of errors on the console.

Thanks for any help !

Can you throw together a codepen?

Sure, will do that tomorrow and come back post it here when it’s ready !

There you go : http://codepen.io/JerryBels/pen/WbovEg

I used the one you made for me here : Vertical slide between two screens as a basis.

Basically when you drag up the top screen more than 50px, it hides and displays the bottom one, and when you drag down the bottom one 50px, it hides and shows the top one. The problem is, when this triggers, I want to ignore the next drag items - basically call a “release” event, or prevent the user from scrolling with his finger, so the $ionicScrollDelegate.anchorScroll can do its work - which is prevented as long as the user interacts with the scrolling.

Until now I failed to find a solution to that.

Thanks again :blush:

1 Like

Hm, will look at this.

Just a heads up, you may want to start abstracting this out into a directive and not keep it in a controller.

I’m still young with Angular, forgive me master :stuck_out_tongue: (not sure how to make a usefull directive with this…)