From f520a6319c0669d877d9f9a5a535178569b44deb Mon Sep 17 00:00:00 2001 From: Adam Bradley Date: Wed, 9 Dec 2015 21:55:17 -0600 Subject: [PATCH] fix(itemSliding): enableSlidingItems --- ionic/components/list/list.ts | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/ionic/components/list/list.ts b/ionic/components/list/list.ts index 0189f0c2bd..9168239397 100644 --- a/ionic/components/list/list.ts +++ b/ionic/components/list/list.ts @@ -77,22 +77,19 @@ export class List extends Ion { } enableSlidingItems(shouldEnable) { - if (this._init) { + if (this._enableSliding !== shouldEnable) { + this._enableSliding = shouldEnable; - if (this._enableSliding !== shouldEnable) { - this._enableSliding = shouldEnable; - - if (shouldEnable) { - console.debug('enableSlidingItems'); - this.zone.runOutsideAngular(() => { - setTimeout(() => { - this.slidingGesture = new ItemSlidingGesture(this, this.ele); - }); + if (shouldEnable) { + console.debug('enableSlidingItems'); + this.zone.runOutsideAngular(() => { + setTimeout(() => { + this.slidingGesture = new ItemSlidingGesture(this, this.ele); }); + }); - } else { - this.slidingGesture && this.slidingGesture.unlisten(); - } + } else { + this.slidingGesture && this.slidingGesture.unlisten(); } } } @@ -101,15 +98,6 @@ export class List extends Ion { this.slidingGesture && this.slidingGesture.closeOpened(); } - /** - * @private - */ - ngAfterViewInit() { - this._init = true; - if (this._enableSliding) { - this.enableSlidingItems(true); - } - } }