1

I'm trying to have a ion-list with button and checkbox or radio at the end of the line. That's my code without checkbox/radio:

<button ion-item (click)="editItem(i, item)">
    <ion-avatar item-start>
        <img [src]="item.photo" />
    </ion-avatar>
    <h2>{{item.name}}</h2>
    <p>{{item.info}}</p>
</button>

It works and I can show any information about Item object.
If I add checkbox or radio my info disappear and the button click don't work (always checkbox change event trigger).

<button ion-item (click)="editItem(i, item)">
    <ion-avatar item-start>
        <img [src]="item.photo" />
    </ion-avatar>
    <h2>{{item.name}}</h2>
    <p>{{item.info}}</p>
    <ion-checkbox (ionChange)="fireEvent(i, $event)"></ion-checkbox>
</button>

How can I have a button and checkbox in same row ?

0

1 Answer 1

1

You can use the grid system to put elements on the same row:

<ion-grid>
  <ion-row>
    <ion-col>
     <button ion-item (click)="editItem(i, item)">
      <ion-avatar item-start>
        <img [src]="item.photo" />
      </ion-avatar>
     <h2>{{item.name}}</h2>
     <p>{{item.info}}</p>
     </button>
    </ion-col>
    <ion-col>
      <ion-checkbox (ionChange)="fireEvent(i, $event)"></ion-checkbox>
   </ion-col>
  </ion-row>
 </ion-grid>

more info here:

https://ionicframework.com/docs/api/components/grid/Grid/

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.