This commit is contained in:
Max Lynch
2015-06-25 10:45:29 -05:00
parent 0a6e8b8719
commit da45d5ee31

View File

@ -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();
}) })