mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 03:32:21 +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));
|
radio.id = radio.id || ('radio-' + this.id + '-' + (++this.radioIds));
|
||||||
this.radios.push(radio);
|
this.radios.push(radio);
|
||||||
|
|
||||||
console.log("Radio", radio.id, radio.value, radio.checked);
|
|
||||||
if (this.value == radio.value) {
|
if (this.value == radio.value) {
|
||||||
radio.check(this.value);
|
radio.check(this.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (radio.checked) {
|
if (radio.checked) {
|
||||||
this.value = radio.value;
|
this.value = radio.value;
|
||||||
|
this.onChange(this.value);
|
||||||
this.activeId = radio.id;
|
this.activeId = radio.id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,8 +39,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div padding>
|
<div padding>
|
||||||
<code>fruits.dirty: {{fruitsForm.controls.fruits.dirty}}</code><br>
|
<code><b>fruits.dirty:</b> {{fruitsForm.controls.fruits.dirty}}</code><br>
|
||||||
<code>fruits.value: {{fruitsForm.controls.fruits.value}}</code><br>
|
<code><b>fruits.value:</b> {{fruitsForm.controls.fruits.value}}</code><br>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form (submit)="doSubmit($event)" [ng-form-model]="currencyForm">
|
<form (submit)="doSubmit($event)" [ng-form-model]="currencyForm">
|
||||||
@ -53,7 +53,7 @@
|
|||||||
</form>
|
</form>
|
||||||
|
|
||||||
<div padding>
|
<div padding>
|
||||||
<code>currenciesControl.value: {{currencyForm.controls.currenciesControl.value}}</code>
|
<code><b>currenciesControl.value:</b> {{currencyForm.controls.currenciesControl.value}}</code>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ion-radio-group [(ng-model)]="relationship">
|
<ion-radio-group [(ng-model)]="relationship">
|
||||||
@ -62,7 +62,7 @@
|
|||||||
</ion-radio-group>
|
</ion-radio-group>
|
||||||
|
|
||||||
<div padding>
|
<div padding>
|
||||||
<code>relationship: {{relationship}}</code>
|
<code><b>relationship:</b> {{relationship}}</code>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</ion-content>
|
</ion-content>
|
||||||
|
Reference in New Issue
Block a user