import { Directive , ElementRef , Inject , Input } from '@angular/core' ; import { Material as MaterialService } from '../../../services/ui' ; @ Directive ( { selector : '[mdlSwitch]' , inputs : [ 'mdlSwitch' , 'toggled' ] , } ) export class MaterialSwitch { mdlSwitch : any ; private element : any ; private _toggled : boolean = false ; constructor ( _element ) { this . element = _element . nativeElement ; } ngAfterViewInit ( ) { } set toggled ( value ) { MaterialService . updateElement ( this . element ) ; if ( value ) this . element . classList . add ( 'is-checked' ) ; } }