I have an UI which contains a list of items and an item in the list may or may not have a radio button in it. What I am trying to do is capture two different actions/interactions on an item when there is a radio-button available in it.
Here is the screenshot:
In other words, I am trying to implement following two behaviors:
-
When there is a radio-button in the item:
a. Just to select an an item, I want the user to “explicitly” tap on the radio-button. Nothing else should happen.
b. To view the details of an item, I want the user to tap anywhere in the item except for the radio-button.
-
When there is no radio-button in the item, a tap on the item will take the user to view the details of that item (i.e., same as the behavior of #1b)
I want to capture the “click” event on the ion-item
as well as on the ion-radio
separately.
Right now, #2 above is working. But can’t get #1 to work as I want to. When there is a radio-button in the item I am not able to separate the taps…a tap anywhere in the item gets the radio-button selected which I don’t want to happen.
Here is the code:
<ion-content >
<ion-list radio-group>
<ion-item *ngFor="let account of accounts" detail-push (click)="showAccountDetails(account)">
<ion-radio item-left [value]="account.accountId" *ngIf="account.inNew == 'No'" (click)="showAlert(account.accountId)"></ion-radio>
<ion-label >
{{account.accountName}}
</ion-label>
</ion-item>
</ion-list>
<button block ion-button>
Move
</button>
</ion-content>
Any ideas on how I should implement it?
Thanks.