title: Angular: Toggle class on an element's parent when using ngFor directive
body: <p>I'm styling a checkbox as a button by placing it inside it's label</p>
  
  <pre><code>&lt;label&gt;
   &lt;input type="checkbox" name="..."&gt;
  &lt;/label&gt;
  </code></pre>
  
  <p>I need to toggle the parent label's class based on whether the checkbox is checked. Now, this would be easy using [ngClass] and a boolean. The problem is, I'm also looping the elements with an *ngFor directive. This apparently used to work in Angular 1.x.x, but in Angular 2/4/... it adds/removes the class for all elements that are repeated. 
  This could easily be solved by accessing the parent DOM elements classList directly, but this is considered a bad practise in Angular. Is there any Angular way to do this or do I have to change my approach completely?</p>
  
  <p>EDIT: my code
  EDIT 2: Wrong code, fixed.</p>
  
  <pre><code>  &lt;label *ngFor="let item of object.array" [ngClass]="{'label-active': checked}"&gt;
      {{item}}
      &lt;input (click)= "checked = !checked"  type="checkbox" name="..." id="..." class="sr-only"&gt;
    &lt;/label&gt;
  </code></pre>