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.
First I want to create above UI and secondly when a user select any of the box the background color will change. How can I achieve this?
<div *ngFor="let item of examlist; let i = index" [class.active]="item.select"
(click)="item.select=!item.select">
{{item.name}}
</div>
<button (click)="saveSelected"/>
in your controller.ts file:
function saveSelected(index:number):void{
const result = examlist.filter(ex => ex.select == true); // res is the list of all selected exams
api.save(res)...
}
Especially on touchscreens, consistency of presentation is a really important design goal, and it’s being stomped on here. The sample image you presented already has a different number of options on each line, and the physical placement of the items does not lie anywhere near a consistent axis. If, as you say, there are actually 3x more items to go, this is only going to get exacerbated.
Also, these look like action buttons. Users are conditioned that touching an action button causes an action to happen.
Finally, you’re using a toolkit/framework in Ionic that contains lots of interface widgets specifically designed for familiarity and ease of use in touchscreen context. It contains a radio group component that dovetails perfectly with your goal of “get a single choice from the user of several options”. I would strongly suggest using it here.
Thanks for information but in my case user can select more than one options.So i am thinking of using checkbox but i am unable to do it.After mous12 help i have created this UI that does seems to be exacerbated.