title: setTimeOut() gets repeated in Angular Lifecycle Hooks: ngDoCheck, ngAfterContentChecked, ngAfterViewChecked
body: <h2>Reproducibility</h2>
  
  <p>I have a small TypeScript code snippet as below:</p>
  
  <pre><code>ngAfterViewChecked(){
      console.log("ngAfterViewChecked 1");
      setTimeout(() =&gt; {
        console.log("ngAfterViewChecked 2");
      }, 1000);
    }
  </code></pre>
  
  <p>Function <code>setTimeOut()</code> is supposed to get the lambda function called after 1 second and <em>then stop</em>. However, the hook ngAfterViewChecked() is called continuously (excerpt from Chrome Developer Tool Console):</p>
  
  <pre><code>00:36:50.827 home.component.ts:53 ngAfterViewChecked 1
  00:36:51.842 home.component.ts:55 ngAfterViewChecked 2
  00:36:51.843 home.component.ts:53 ngAfterViewChecked 1
  00:36:52.843 home.component.ts:55 ngAfterViewChecked 2
  00:36:52.844 home.component.ts:53 ngAfterViewChecked 1
  00:36:53.845 home.component.ts:55 ngAfterViewChecked 2
  00:36:53.846 home.component.ts:53 ngAfterViewChecked 1
  00:36:54.848 home.component.ts:55 ngAfterViewChecked 2
  ...
  </code></pre>
  
  <p><strong>Without</strong> the <code>setTimeOut()</code>, function <code>ngAfterViewChecked()</code> is called once. This issue occurs also with <code>ngDoCheck()</code>, <code>ngAfterContentChecked()</code>.</p>
  
  <h2>Test with other Angular Lifecycle Hooks</h2>
  
  <p>The same code body, <strong>with or without</strong> <code>setTimeOut()</code>, declared in <code>constructor()</code>, <code>ngOnInit()</code>, <code>ngAfterContentInit()</code>, <code>ngAfterViewInit()</code>, gets called once as expected.</p>
  
  <h2>Environment</h2>
  
  <ul>
  <li>The program is very simple (like "Hello World" for Angular). No 3rd party library.</li>
  <li><p>Both Angular 5 &amp; 6 have this issue (lower versions haven't been tested). They were installed separately in different machines.</p>
  
  <pre><code>Angular CLI: 6.0.8
  Node: 8.11.3
  OS: win32 x64
  Angular: 6.0.9
  
  
  Angular CLI: 1.7.4
  Node: 8.11.1
  OS: win32 x64
  Angular: 5.2.10
  </code></pre></li>
  <li><p>Windows 8.1 x64.</p></li>
  <li>Google Chrome 67 (64 bit).</li>
  </ul>
  
  <h2>My guess</h2>
  
  <p>The hooks <code>constructor()</code>, <code>ngOnInit()</code>, <code>ngAfterContentInit()</code>, <code>ngAfterViewInit()</code> are called once in the entire Lifecycle of a Component, regardless of how its content evolves through out its life. So this issue reasonably doesn't happen in these hooks.</p>
  
  <p>With <code>ngDoCheck()</code>, <code>ngAfterContentChecked()</code> and <code>ngAfterViewChecked()</code>, they get called when Angular <em>detects changes</em>. But as showed in the lambda function body, only simple <code>console.log()</code> is used. I think Angular might intercept the <code>setTimeOut()</code> call and blindly believes that there could have been some changes, so it starts the Change Detection process, which leads to what we have seen: calls <em>chained infinitely</em>.</p>
  
  <h2>Question</h2>
  
  <p>Is this a bug or a feature?</p>