slidingItem.close() not Working


#1

Hi Guys,
I have Created a Sliding item list by using this:

<ion-list>
        <ion-item-sliding style="width: 50%; border-top-right-radius: 25px; border-bottom-right-radius: 25px;" #slidingItem>
            <ion-item style="background-color: #222; color:white" no-lines>
              Call<span class="spanright" style="float: right;">
                  <ion-icon name="call"></ion-icon>
                </span>
            </ion-item>
            <ion-item-options side="left" (ionSwipe)="saveItem(slidingItem)">
              <button ion-button expandable color="secondery">Call Person</button>
            </ion-item-options>
          </ion-item-sliding>
</ion-list>

i have tried to close swiped item on (ionSwipe) function fired but failed.
Here is my Code below:


import { IonicPage, NavController, NavParams, LoadingController, ItemSliding } from 'ionic-angular';

saveItem(slidingItem: ItemSliding) {
    console.log('swipe fully') //  <--fired

    window.open('tel:+ 91' + this.selectedUtilityPeople.Mobile)  //  <--fired
    slidingItem.close();   //   <--not working
  }

please Help

thanks


#2

Try this (worked for me) :

    setTimeout(() => {
      slidingItem.close();
    }, 1);

I think the reason why it isn’t working is because of the (still running) animation and state of the sliding item (???)


#3

awesome.
thank u so much