fix(radio): fixed radio so if the radio is checked it will update the value itself

fixes #530
This commit is contained in:
Brandy Carney
2015-11-25 16:50:41 -05:00
parent 8feb951bf5
commit 4f9583d2b8
2 changed files with 5 additions and 5 deletions

View File

@ -91,13 +91,13 @@ export class RadioGroup extends Ion {
radio.id = radio.id || ('radio-' + this.id + '-' + (++this.radioIds));
this.radios.push(radio);
console.log("Radio", radio.id, radio.value, radio.checked);
if (this.value == radio.value) {
radio.check(this.value);
}
if (radio.checked) {
this.value = radio.value;
this.onChange(this.value);
this.activeId = radio.id;
}
}

View File

@ -39,8 +39,8 @@
</div>
<div padding>
<code>fruits.dirty: {{fruitsForm.controls.fruits.dirty}}</code><br>
<code>fruits.value: {{fruitsForm.controls.fruits.value}}</code><br>
<code><b>fruits.dirty:</b> {{fruitsForm.controls.fruits.dirty}}</code><br>
<code><b>fruits.value:</b> {{fruitsForm.controls.fruits.value}}</code><br>
</div>
<form (submit)="doSubmit($event)" [ng-form-model]="currencyForm">
@ -53,7 +53,7 @@
</form>
<div padding>
<code>currenciesControl.value: {{currencyForm.controls.currenciesControl.value}}</code>
<code><b>currenciesControl.value:</b> {{currencyForm.controls.currenciesControl.value}}</code>
</div>
<ion-radio-group [(ng-model)]="relationship">
@ -62,7 +62,7 @@
</ion-radio-group>
<div padding>
<code>relationship: {{relationship}}</code>
<code><b>relationship:</b> {{relationship}}</code>
</div>
</ion-content>