Reputation: 65
I am using Ionic 3 and I want to use checkbox for the user to select which exam he/she is preparing. But I am unable to create this layout (UI). My exam list is coming from api.
When a user select any of the box the background color will change. How can I achieve this?
Upvotes: 0
Views: 59
Reputation: 399
Instead, you can use ion-segment component to change the UI of the current page with binding that button's value to background color.
As in docs you can manipulate like this for your sake. You can manipulate the UI according to your needs. Does that answer your question ?
<div padding>
<ion-segment [(ngModel)]="examType">
<ion-segment-button value="CPO">
CPO
</ion-segment-button>
<ion-segment-button value="CHSL">
CHSL
</ion-segment-button>
</ion-segment>
</div>
<div [ngSwitch]="examType">
<ion-list *ngSwitchCase="'CPO'">
<div class="background-color-cpo"> </div>
</ion-list>
<ion-list *ngSwitchCase="'CHSL'">
<div class="background-color-CHSL"> </div>
</ion-list>
</div>
Upvotes: 3