user5772827
user5772827

Reputation:

Ionic angular radio default checked

I have a radio list group and i am looking for solution to check by default the radio with value="free_shipping:0" in the group, which is second in the group.

<ion-list radio-group [(ngModel)]="chosen_shipping" 
(ngModelChange)="updateShipping(chosen_shipping)" 
class="ship">

          <ion-item *ngFor="let method of shipping | keys" >
            <ion-label>{{method.value.method_title}}
            </ion-label>
            <ion-radio value="{{method.value.id + ':' + method.value.instance_id}}" >
            </ion-radio>
          </ion-item>

   </ion-list>

Upvotes: 0

Views: 4304

Answers (1)

Vivek Doshi
Vivek Doshi

Reputation: 58603

Set default value from your component

chosen_shipping = "free_shipping:0"

This will set the default selected radio for your ionic radio.

Upvotes: 1

Related Questions