import { Directive , ElementRef , Input , Renderer } from '@angular/core' ; import { Config } from '../../config/config' ; import { DomController } from '../../platform/dom-controller' ; import { GestureController } from '../../gestures/gesture-controller' ; import { Ion } from '../ion' ; import { isTrueProperty } from '../../util/util' ; import { ItemSlidingGesture } from '../item/item-sliding-gesture' ; import { Platform } from '../../platform/platform' ; demo see {@link /docs/components#lists List Component Docs} advanced Component ViewChild @ Directive ( { selector : 'ion-list' , } ) export class List extends Ion { private _enableSliding : boolean = true ; private _containsSlidingItems : boolean = false ; private _slidingGesture : ItemSlidingGesture ; constructor ( config , elementRef , renderer , private _plt , private _gestureCtrl , private _domCtrl ) { super ( config , elementRef , renderer , 'list' ) ; } input @ Input ( ) get sliding ( ) : boolean { return this . _enableSliding ; } set sliding ( val ) { this . _enableSliding = isTrueProperty ( val ) ; this . _updateSlidingState ( ) ; } hidden containsSlidingItem ( contains ) { this . _containsSlidingItems = contains ; this . _updateSlidingState ( ) ; } private _updateSlidingState ( ) { let shouldSlide = this . _enableSliding && this . _containsSlidingItems ; if ( ! shouldSlide ) { this . _slidingGesture && this . _slidingGesture . destroy ( ) ; this . _slidingGesture = null ; } else if ( ! this . _slidingGesture ) { console . debug ( 'enableSlidingItems' ) ; this . _slidingGesture = new ItemSlidingGesture ( this . _plt , this , this . _gestureCtrl , this . _domCtrl ) ; this . _slidingGesture . listen ( ) ; } } /**
     * Close any sliding items that are open.
     */ closeSlidingItems ( ) { this . _slidingGesture && this . _slidingGesture . closeOpened ( ) ; } hidden destroy ( ) { this . _slidingGesture && this . _slidingGesture . destroy ( ) ; } }