emit the selectedButton instead of just the value of the selectedButton

This commit is contained in:
Eddie Lau 3dd13
2015-12-29 15:24:06 +08:00
parent d8350f0440
commit 4f254a87de

View File

@ -66,7 +66,7 @@ export class SegmentButton {
@HostListener('click', ['$event']) @HostListener('click', ['$event'])
private onClick(ev) { private onClick(ev) {
console.debug('SegmentButton, select', this.value); console.debug('SegmentButton, select', this.value);
this.select.emit(this.value); this.select.emit(this);
} }
ngOnInit() { ngOnInit() {
@ -166,10 +166,10 @@ export class Segment {
ngAfterViewInit() { ngAfterViewInit() {
let buttons = this._buttons.toArray(); let buttons = this._buttons.toArray();
for (let button of buttons) { for (let button of buttons) {
button.select.subscribe((selectedValue) => { button.select.subscribe((selectedButton) => {
this.writeValue(selectedValue); this.writeValue(selectedButton.value);
this.onChange(selectedValue); this.onChange(selectedButton.value);
this.change.emit(selectedValue); this.change.emit(selectedButton.value);
}); });
if (isDefined(this.value)) { if (isDefined(this.value)) {