0

Any Idea in Angular 5 where I have the checkbox in *ngFor loop so I want to know how this is getting the change in check and uncheck for the particular checkbox in *ngFor.

I have some code as below

<tr *ngFor="let addon of group?.item_addons; let i = index;">
   <td>
       <div class="form-check">
         <label class="form-check-label">
           <input class="form-check-input" type="checkbox" 
           (change)="onselectAddon(addon,$event,group,i)">
           <span class="form-check-sign"></span>
              {{addon.addons_name}}
         </label>
        <span class="float-right">+ {{addon.addons_price}}</span>
       </div>                                                                            
   </td>
</tr>

I want to get selected and unselected value from particular checkbox.

2
  • 1
    you forgot to add your code. Also it's not clear what are you asking. Commented Apr 26, 2018 at 7:29
  • Sorry, I added code have any idea? Commented Apr 26, 2018 at 10:11

1 Answer 1

1

you can simply add to your input the following:

[checked]="someExpression"

if you prefer, you could call a function where you pass the current addon like

[checked]="isChecked(addon)"
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.