blumjs
Version:
A UI Package for Angular2
62 lines (52 loc) • 1.5 kB
text/typescript
import {Component, OnInit, Input, Output, EventEmitter, ElementRef} from "@angular/core";
export class OptionComponent implements OnInit {
disabled: boolean = false;
pinned: boolean = false;
value: any;
onSelect: EventEmitter<OptionComponent> = new EventEmitter<OptionComponent>();
private selected: boolean = false;
hidden: boolean = false;
constructor(private el: ElementRef) {
}
ngOnInit(): void {
}
select() {
if(this.disabled)
return;
this.selected = true;
this.onSelect.emit(this);
}
public getText(): string{
return this.el.nativeElement.innerText;
}
}