redoc/lib/shared/components/DropDown/drop-down.ts

31 lines
658 B
TypeScript
Raw Normal View History

2016-04-19 18:50:01 +03:00
'use strict';
import { Component, EventEmitter, ElementRef, Output, AfterContentInit } from '@angular/core';
2016-08-28 21:46:10 +03:00
import * as DropKick from 'dropkickjs';
2016-04-19 18:50:01 +03:00
@Component({
selector: 'drop-down',
templateUrl: 'drop-down.html',
styleUrls: ['./drop-down.css']
2016-04-19 18:50:01 +03:00
})
export class DropDown implements AfterContentInit {
@Output() change = new EventEmitter();
elem: any;
inst: any;
constructor(elem:ElementRef) {
2016-04-19 18:50:01 +03:00
this.elem = elem.nativeElement;
}
ngAfterContentInit() {
2016-06-06 19:32:20 +03:00
this.inst = new DropKick(this.elem.firstElementChild, {autoWidth: true});
2016-04-19 18:50:01 +03:00
}
onChange(value) {
this.change.next(value);
}
destroy() {
this.inst.dispose();
}
}