Handle radio values

Being new to Ionic 2, I can’t quite figure out how to get the values from a radio button.

in the template I have

<ion-list radio-group> <ion-item> <ion-label>I am acting on behalf of myself</ion-label> <ion-radio checked="true" value="self"></ion-radio> </ion-item> <ion-item> <ion-label>I am acting as an agent</ion-label> <ion-radio value="agent"></ion-radio> </ion-item> </ion-list> <button full (click)="handleResult()">OK</button>

And in the JS,
handleResult() { // access ion-radio items and check which value is checked }

Can someone put me on the right path here please.


I came up with the following:

in html:
<ion-list radio-group [(ngModel)]="actor">

in js

   handleResult() {
        console.log("AgencyPage: HandleResults() - actor=" + this.actor);
        if(this.actor == 'self'){
            // push agent-details page
        else if(this.actor == 'agent'){
            // push client-details page

This turned out much easier than I thought it would be. Is this the right way of going about it?

1 Like

Looks good.