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