Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Javascript
Posted by: Nilesh Yadav
Added: Jan 3, 2018 11:31 AM
Views: 19
Tags: no tags
  1. <div class="form-group">
  2.   <div class="form-check" *ngFor="let tag of tags; let i = index;">
  3.     <label class="form-check-label" for="tag{{tag.value}}">
  4.       <input
  5.         class="form-check-input"
  6.         type="checkbox"
  7.         id="tag{{tag.value}}"
  8.         name="tagOptions"
  9.         (change)="changeCheckbox(i)"
  10.         [checked]="tag.checked">
  11.       {{tag.name}}
  12.     </label>
  13.  </div>
  14.  
  15.  ------------
  16.  
  17.   changeCheckbox(tags, i) {
  18.     if (tags) {
  19.       this.tags[i].checked = !this.tags[i].checked;
  20.     }
  21.   }