mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-22 13:32:54 +08:00
broadcast the selected segment button value to segment and update the segment value accordingly
This commit is contained in:
@ -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(ev, this.value);
|
this.select.emit(this.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
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(() => {
|
button.select.subscribe((selectedValue) => {
|
||||||
this.writeValue(button.value);
|
this.writeValue(selectedValue);
|
||||||
this.onChange(button.value);
|
this.onChange(selectedValue);
|
||||||
this.change.emit(this.value);
|
this.change.emit(selectedValue);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (isDefined(this.value)) {
|
if (isDefined(this.value)) {
|
||||||
|
Reference in New Issue
Block a user