I see this in the API docs for the list component:
import { Component, ViewChild } from '@angular/core';
import { List } from 'ionic-angular';
@Component({...})
export class MyClass {
@ViewChild(List) list: List;
constructor() { }
stopSliding() {
this.list.enableSlidingItems(false);
}
}
but this.list.closeSlidingItems() does nothing. Do I need to do something in my template to bind the list to this.list? I tried putting [(ngModel)]=“list” in the ion-list but it won’t take it.
I had a simliar issue. The debugger said “closeSlidingItems ist not a method” for my list. It seems to b defined in typings but is not implemented during runtime.
My workaround to close all slidingItems for dynamic generated items was:
Give them an id, i.e. <ion-item-sliding #slidingItems *ngFor=“let profile of profileList; let id = index;”>…
Use @ViewChildren(‘slidingItems’) public slidingItems: QueryList; in your component.
Close them manually (I did this during “ionViewWillEnter”)
this.slidingItems.forEach((item) => {
item.close();
});