mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 19:21:34 +08:00
fix(radio): fixed radio so if the radio is checked it will update the value itself
fixes #530
This commit is contained in:
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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>
|
||||
|
Reference in New Issue
Block a user