0

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

1

1 Answer 1

1

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>
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.