Can an Option Button be hidden programmatically?


#1

I have an <ion-list> with <ion-list-item>s that feature an Option Button. So the user can swipe left a list item, revealing the Option button. Great. Then she taps it and an action takes place. But after that, the list item remains as it was - with the Option button showing.

So is there any way to hide that button - to effectively “swipe right” in code, so as to restore the list item to its original state?

Thanks!


#3

You can use $ionicListDelegate to close option buttons.
First set a delegate handle to list. Then closeOptionButtons can be called from controller.

<ion-list delegate-handle="test-list">

$ionicListDelegate.$getByHandle('test-list').closeOptionButtons();

#4

Thank you, @esery1. Just what is needed. Merry Christmas.