Greeting of the day, Have check other solution yet none works.
Why can’t the ion-radio button be default selected?
<ion-col>
<ion-list radio-group [(ngModel)]="allItem.qty" no-lines>
<ion-item>
<ion-label>*1</ion-label>
<ion-radio value="1" checked="true"></ion-radio>
</ion-item>
<ion-item>
<ion-label>*2</ion-label>
<ion-radio value="2"></ion-radio>
</ion-item>
</ion-list>
</ion-col>
Thank you in advance.
jaydz
January 12, 2018, 3:44am
2
it can
<ion-list radio-group>
<ion-item>
<ion-label>a</ion-label>
<ion-radio></ion-radio>
</ion-item>
<ion-item>
<ion-label>b</ion-label>
<ion-radio checked="true"></ion-radio>
</ion-item>
</ion-list>
works for me
jaydz:
checked=“true”
I tried on android device same it is not working weird.
jaydz
January 12, 2018, 3:50am
4
maybe, for some reason, [checked]="true"
will work
not sure if it’s because ngModel made an impact to it?
jaydz
January 12, 2018, 4:20am
6
I wouldn’t think so, but, it’s strange that it’s not working so a strange explanation fits
but in my case its not working
jaydz
March 15, 2018, 6:04pm
8
try <ion-radio checked></ion-radio>
This is precisely it. Exactly as with <ion-select>
, if you bind a model to the parent component, it trumps all attributes set on the children. Assign to allItem.qty
and you will see it reflected in the radio group selection. The checked
attribute only comes into play if there is no bound model on the radio group.