title: Ionic 2: How to use ViewChild instead of app.getComponent
body: <p>I'm migrating my ionic 2 app into RC version in which app.getComponent is removed.
  In their github release notes, they said about using ViewChild, how do I properly use it?</p>
  
  <p>Before(working before RC version):</p>
  
  <pre><code>openPage(page) {
    this.app.getComponent('leftMenu').close();   
    // navigate to the new page if it is not the current page
    let nav = this.app.getComponent('nav');
    nav.setRoot(page.component);  
  }
  </code></pre>
  
  <p>After:</p>
  
  <pre><code>@Component({
    templateUrl: 'build/app.html',
    queries: {
     leftMenu: new ViewChild('leftMenu'),
     nav: new ViewChild('content')
    }
  })
  
  ....
  
  openPage(page) {
      // close the menu when clicking a link from the menu
      this.leftmenu.close();
      // navigate to the new page if it is not the current page
      this.nav.setRoot(page.component);
   }
  </code></pre>
  
  <p>I'm trying to get the 'leftMenu' component without any success. The error i get is </p>
  
  <blockquote>
    <p>browser_adapter.js:77 ORIGINAL EXCEPTION: TypeError: Cannot read
    property 'close' of undefined</p>
  </blockquote>