title: Why class binding do not work with ngOnChanges?
body: <p>I am new at angular. I have tried to add a class if a property named <code>isMajor</code> is true. An if statement toggle the isMajor property depending on the value of <code>propName</code> generated by <code>ngOnChanges</code>.</p>
  
  <p>If I remove this line  </p>
  
  <pre><code>propName === 'major' ? this.isMajor = true : this.isMajor = false;
  </code></pre>
  
  <p>there is no problem.</p>
  
  <p><a href="https://stackblitz.com/edit/angular-class-toggle-ngonchanges" rel="nofollow noreferrer">https://stackblitz.com/edit/angular-class-toggle-ngonchanges</a></p>
  
  <pre><code>/* tslint:disable:forin */
  import { Component, Input, OnChanges, SimpleChange } from '@angular/core';
  
  @Component({
    selector: 'app-hero-child',
    template: `
      &lt;h3&gt;Version {{major}}.{{minor}}&lt;/h3&gt;
      &lt;h4&gt;Change log:&lt;/h4&gt;
      &lt;ul&gt;
        &lt;li *ngFor="let change of changeLog" [class.major]="isMajor"&gt;{{change}}&lt;/li&gt;
      &lt;/ul&gt;
    `
  })
  export class HeroChildComponent implements OnChanges {
    @Input() major: number;
    @Input() minor: number;
    changeLog: string[] = [];
    isMajor = false;
  
    ngOnChanges(changes: {[propKey: string]: SimpleChange}) {
      for (let propName in changes) {
        let changedProp = changes[propName];
        let to = JSON.stringify(changedProp.currentValue);
        propName === 'major' ? this.isMajor = true : this.isMajor = false;
        if (changedProp.currentValue == 0) return;
        if (changedProp.isFirstChange()) {
          this.changeLog.push(`Initial value of ${propName} set to ${to}`);
        } else {
          let from = JSON.stringify(changedProp.previousValue);
          this.changeLog.push(`${propName} changed from ${from} to ${to}`);
        }
      }
    }
  }
  </code></pre>
  
  <p>Why this code does not add a 'major' class in each li that correspond to a major release ?</p>
  
  <p>Why this does not work with ngOnChanges ?</p>
  
  <p>Thank you =)</p>