mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 11:41:20 +08:00
IT WORKS
This commit is contained in:
@ -117,12 +117,11 @@ export class Segment {
|
|||||||
register(segmentButton) {
|
register(segmentButton) {
|
||||||
this.buttons.push(segmentButton);
|
this.buttons.push(segmentButton);
|
||||||
|
|
||||||
console.log('registering', this.buttons, this.value);
|
// If this button is registered and matches our value,
|
||||||
|
// make sure to select it
|
||||||
if(this.value == segmentButton.value) {
|
if(this.value == segmentButton.value) {
|
||||||
this.selected(segmentButton);
|
this.selected(segmentButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -132,12 +131,10 @@ export class Segment {
|
|||||||
for(let button of this.buttons) {
|
for(let button of this.buttons) {
|
||||||
if(button.value === value) {
|
if(button.value === value) {
|
||||||
button.isActive = true;
|
button.isActive = true;
|
||||||
//this.selected(button);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicate a button should be selected.
|
* Indicate a button should be selected.
|
||||||
*/
|
*/
|
||||||
@ -151,12 +148,17 @@ export class Segment {
|
|||||||
|
|
||||||
//this.onChange();
|
//this.onChange();
|
||||||
|
|
||||||
//this.change.next();
|
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.value = segmentButton.value;
|
this.value = segmentButton.value;
|
||||||
this.cd.valueAccessor.writeValue(segmentButton.value);
|
this.cd.valueAccessor.writeValue(segmentButton.value);
|
||||||
this.selectFromValue(segmentButton.value);
|
this.selectFromValue(segmentButton.value);
|
||||||
|
console.log(this.cd);
|
||||||
|
|
||||||
|
this.cd.form.updateValue(segmentButton.value);
|
||||||
|
|
||||||
|
// Trigger on change
|
||||||
|
this.change.next();
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user