title: Ionic 2 - Runtime Error No provider for NavController
body: <p>I understand there are similar questions based on this. I believe my scenario is little different. I am trying to check a value in native storage, if it is true. I am trying to navigate to the HomePage. By now after reading couple of articles,I know i wont be able to use the NavController a dependency injector. </p>
  
  <p>I have also tried using @ViewChild , but for that I assume I would need to define a variable in the template that I will use. However I am using an html template. I am new to Ionic 2 and Angular 2, so please go little easy on me :-). </p>
  
  <p>Any other way in which i can accomplish that? Please elaborate a bit more if you guys have a solution to this.</p>
  
  <p>This is my code from app.components.ts (below). Currently I have just commented the navCtrl code.</p>
  
  <pre><code>import { Component,ViewChild } from '@angular/core';
  import { Platform } from 'ionic-angular';
  import { StatusBar } from '@ionic-native/status-bar';
  import { SplashScreen } from '@ionic-native/splash-screen';
  import { LoginPage } from '../pages/login/login';
  import { NativeStorage } from '@ionic-native/native-storage';
  import { NavController } from 'ionic-angular';
  import { HomePage } from '../pages/home/home';
  
  @Component({
    templateUrl: 'app.html',
  
  })
  export class ClassetteApp {
    @ViewChild("appNav") nav: NavController;
    rootPage:any = LoginPage;
  
    constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen, private nativeStorage : NativeStorage) {
      platform.ready().then(() =&gt; platform.ready().then(() =&gt; {
         this.nativeStorage.getItem("userId").then(function(data){
          this.nav.push(HomePage);
          },function(error){
           this.nav.push(LoginPage);
          })
        statusBar.styleDefault();
        splashScreen.hide();
      })
      )}
  }
  </code></pre>
  
  <p>here is my app.html. </p>
  
  <pre><code>&lt;ion-nav #appNav [root]="rootPage"&gt;&lt;/ion-nav&gt;
  </code></pre>