title: Why do i need to add markForCheck() to trigger change detection in Angular?
body: <p><strong>I don't quite understand why i need to add markForCheck() to the code below to make the changes visible. Why is my @Input() not triggering change detection?</strong></p>
  
  <p>I am refactoring my project to OnPush. These 2 components both have OnPush enabled. As i understand it, when this is enabled, and an Input() is changed (like <code>messages</code>) the change detection gets triggered.</p>
  
  <p>In the code below i make a call via the <code>graphqlService</code>. When i receive the call i do some parsing with the incoming data and then set it to <code>informationMessages</code> property, which is binded to the child component <code>cv-messages</code> through its <code>messages</code> property.</p>
  
  <p>The result is that the <code>ngOnChanges</code> function only get called once, when the <code>informationMessages</code> property gets initialized. But not when the final parsed data is set to it.</p>
  
  <p>If I add markForCheck() it works fine.</p>
  
  <p>Consider this parent component, with a template like this:</p>
  
  <pre><code>&lt;cv-messages [messages]="informationMessages"&gt;&lt;/cv-messages&gt;
  </code></pre>
  
  <p>And a typescript file with this piece of code:</p>
  
  <pre><code>informationMessages: InformationMessageType[] = [];
  
  ngOnInit() {
      this.graphqlService.loadInformationMessages().subscribe(data =&gt; {
          const informationMessages: InformationMessageType[] = data;
  
          .... // parsing stuff
  
          this.informationMessages = informationMessages;
          // add markForCheck() here
      });
  }
  </code></pre>
  
  <p>The messages component has an ngOnChanges function like this:</p>
  
  <pre><code>ngOnChanges(changes) {
      console.log(this.constructor.name ' CHANGE:', changes);
  }
  </code></pre>
  
  <p><strong>Update:</strong></p>
  
  <p>You can find the solution in the comments of an answer below. Basically, change detection is <strong>NOT</strong> triggered when an <code>@Input()</code> changes asynchronously. So in that case we need to add a <code>markForCheck()</code> to force a change detection.</p>