Detecting if an item is swiped open?


#1

I have an ion-list of items which I have opening a modal if ng-clicked. However, I’ve also got option buttons on these items. Is it possible to easily detect whether the item is open or not when handling the ng-click, so that if the option buttons are visible, it will call $ionicListDelegate.closeOptionButtons() rather than the ng-click action?

ie:

item is closed: tap opens modal details
item is swiped open: tap closes the item/hides the option buttons


#2

Is there an answer to this?


#3

The $ionicListDelegate doesn’t offer any methods for checking this. You can do it in two hacky ways:
By checking if the option buttons container has the class ‘invisible’ on it (might be hard).
By modifying the Ionic core source code (not recommended, though), so you can just expose and check the _lastDragOp field from the listView controller. It’s null if the option buttons are closed.


#4

+1 adding this to the $ionicListDelegate so we know when one of the list items has been swiped open. This has come up a couple times for us now :cry: