Reputation: 207
I want to get all selected option or value from the array list. I'm getting the list and display them in checkbox list, I'm selecting and deselecting checkbox.so when I submit, I just want only selected checkbox value. Here is code of html page:
<ion-item *ngFor="let job of jobs; let i= index" >
<ion-label >{{job.Des_Name}}</ion-label>
<ion-checkbox ></ion-checkbox>
</ion-item>
when click I want only selected checkboxes list or positions suppose I had selected 1,2,5 position I want that only list
Upvotes: 0
Views: 659
Reputation: 1883
In your .ts
file:
jobs = [
{
Des_Name: 'name1',
},
{
Des_Name: 'name2',
},
{
Des_Name: 'name3',
},
{
Des_Name: 'name4',
},
];
do_sth(index) {
console.log(index);
//you can find the selected job
}
and in you .html
file:
<ion-item *ngFor="let job of jobs; let i= index">
<ion-label>{{job.Des_Name}}</ion-label>
<ion-checkbox (ionChange)="do_sth(i)"></ion-checkbox>
</ion-item>
Upvotes: 1