Ion-radio with checked="true" does not work?

The code that I have above does not work anymore. The last ion-radio is always checked even if the _orderBy=‘id’!

Any clue?

I am using beta 0

Thanks

Just to let you know that everything is fixed in beta.1!

no, in beta.1,ion-radio has a very big bug. @brandyshea


image

ion-radio could be multiple checked.

I don’t have that issue in my side. The only issue that had was the “checked” property was not working.

Hi,
In ionic 2 checked did’t work. Anybody fixed ?
could you please share the code ?
How to set the default selection from angular 2 ?

value attribut doesn’t work. Just remove it.

Try this:

< ion-item *ngFor=“let item of items”>
< ion-label>{{item.label}}< /ion-label>
< ion-radio (ionSelect)=“updateFilter(item)” [checked]=“filterEquals(currentFilter, item)”>< / ion-radio>
< /ion-item>

Hi, I have some options in a product and a boolean property called selected and doesnt work being true or false.

<ion-item *ngFor="let option of product.options"> <ion-label>{{option.value}}</ion-label> <ion-radio value="{{option.value}}" checked="{{option.selected}}" disabled="{{fromCart}}"></ion-radio> </ion-item>

Someone have something like this working?

1 Like

You just need to assign a value to the status variable.
when you manage the radio-group with [(ngModel)]=“status” on your .ts file you can specify
public status:any;
and on the constructuor assign to the correct value
this.status=1

It works for me

3 Likes

@juanlus provided the correct answer. This is very simple and works perfectly.

I have 2 pages, Registration page and DataDisplay page. In DataDisplay page I have a button named edit. So when I click on edit button it goes on registration page but with filled data. But I have 2 radio button Pending and Finished, so how can I make one of them selected on the click of edit button??
thanks :slight_smile:

I’m also confused on how to get this to work.

<ion-radio color=“primary-button” value=“N” [checked]=“selected”>

In .ts file
selected = true;

I don’t see checked getting checked.

Got working with checked={{selected}}

Check this tutorial for Ionic 4 http://www.freakyjolly.com/ionic-4-add-radio-lists-in-radio-group-example-and-tutorial/

sir its not worked for me

Muito bem!!!
Usei o código da colega e ficou show!!
<ion-list radio-group [(ngModel)]=“usuario.tipp” name=“tipo”>

        <ion-item>
          <ion-label>Comerciante</ion-label>
          <ion-radio value="E">Comerciante</ion-radio>
        </ion-item>            

        <ion-item>
            <ion-label>Entregador(a)</ion-label>
        <ion-radio value="D">Entregador(a)</ion-radio>
        </ion-item>

        <ion-item>
            <ion-label>Cliente</ion-label>
        <ion-radio value="C">Cliente</ion-radio>
        </ion-item>


    </ion-list>