title: How to Identify whether a Angular2 component is completely loaded ( including ViewChilds ) when there is ngIf in template
body: <p>Is it possible to Identify whether a Angular2 component (here AppComponent) is completely  loaded ( including ViewChilds ) when there ngIf in template  which conditionally loads the child.</p>
  
  <p>Reference: <a href="https://stackoverflow.com/questions/34947154/angular-2-viewchild-annotation-returns-undefined">Angular 2 @ViewChild annotation returns undefined</a>
  This example is taken from the above reference. Thanks to <a href="https://stackoverflow.com/users/1457033/kenecaswell">kenecaswell</a></p>
  
  <pre><code>import {Component, ViewChild, OnInit, AfterViewInit} from 'angular2/core';
  import {ControlsComponent} from './child-component-1';
  import {SlideshowComponent} from './slideshow/slideshow.component';
  
  @Component({
      selector: 'app',
      template:  `
          &lt;div *ngIf="controlsOn"&gt;
              &lt;controls &gt;&lt;/controls&gt;
              &lt;slideshow&gt;&lt;/slideshow&gt;
          &lt;/div&gt;
      `,
      directives: [SlideshowComponent, ControlsComponent]
  })
  
  export class AppComponent {
      @ViewChild(ControlsComponent) controls:ControlsComponent;   
      @ViewChild(SlideshowComponent) slide:SlideshowComponent;
  
      controlsOn:boolean = false;
  
      ngOnInit() {
          console.log('on init', this.controls);
          // this returns undefined
      }
  
      ngAfterViewInit() {
          console.log('on after view init', this.controls);
          // this returns null
      }
  
  }
  </code></pre>
  
  <p>The ngOnInit &amp;&amp; ngAfterViewInit are fired before the the child components are loaded because of the ngIf condition</p>
  
  <p>I need identify when SlideshowComponent &amp; ControlsComponent are loaded and perform an action based on that.</p>
  
  <p>I have a hacky solution which is not suitable when there are multiple ViewChilds (Which are of different type)
  - Using an event emitter to inform when the child is loaded.</p>
  
  <p>I'm posting this question since there were no proper solution after hours of research.</p>