ORIGINAL EXCEPTION: No provider for NavController!

Hi folks!

I’m pretty new to ionic. Although I’m getting this error in this simple script the navigation works like charming. But I want to get rid of this errors coming up. Since the error says that “No provider for NavController” I tried adding NavController to the providers array(might be a silly attempt :confused:). Then the navigation didn’t work at all. According to the google search I tried “@Inject(NavController) navCtrl” to inject the navController instead of “private navCtrl: NavController”. But no luck! Google search result is killing me since various syntax are out there related to the different versions. So any help would be highly appreciated.


Your system information:

Cordova CLI: 6.3.1
Gulp version:  CLI version 3.9.1
Gulp local:
Ionic CLI Version: 2.0.0-beta.37
Ionic App Lib Version: 2.0.0-beta.20
Node Version: v6.5.0

My code >>

import { Component } from '@angular/core';
import { ionicBootstrap, NavController } from 'ionic-angular';
import {TimerWrapper} from '@angular/core/src/facade/async';

import { LoginPage } from '../../pages/login/login';

  templateUrl: 'build/pages/flash-screen/flash-screen.html',
export class FlashScreenPage {
  constructor(private navCtrl: NavController) {
    // Redirect the Flash screen to login after 3000millis
      TimerWrapper.setTimeout(() => {  
      }, 3000);      


The Error >>

EXCEPTION: Error: Uncaught (in promise): EXCEPTION: Error in ./FlashScreenPage class FlashScreenPage_Host - inline template:0:0
    ORIGINAL EXCEPTION: No provider for NavController!
    Error: DI Exception
        at NoProviderError.BaseException [as constructor] (http://localhost:8100/build/js/app.bundle.js:1957:23)
        at NoProviderError.AbstractProviderError [as constructor] (http://localhost:8100/build/js/app.bundle.js:28613:16)
        at new NoProviderError (http://localhost:8100/build/js/app.bundle.js:28650:16)
        at ReflectiveInjector_._throwOrNull (http://localhost:8100/build/js/app.bundle.js:29647:19)
        at ReflectiveInjector_._getByKeyDefault (http://localhost:8100/build/js/app.bundle.js:29675:25)
        at ReflectiveInjector_._getByKey (http://localhost:8100/build/js/app.bundle.js:29638:25)
        at ReflectiveInjector_.get (http://localhost:8100/build/js/app.bundle.js:29447:21)
        at ElementInjector.get (http://localhost:8100/build/js/app.bundle.js:31218:48)
        at ElementInjector.get (http://localhost:8100/build/js/app.bundle.js:31218:48)
        at DebugAppView._View_FlashScreenPage_Host0.createInternal (FlashScreenPage.template.js:16:76)
    [object Object]

I got the same problem since I upgraded to rc0

ionicBootstrap should not be used in rc0 did you read the changelog?

1 Like

willing to upgrade…

Super thanks for the clue, problem solved! now I’m confusing about the versions, [quote=“wannix, post:1, topic:64919”]
Ionic App Lib Version: 2.0.0-beta.20
what is this version number? they have only up to 2.0.0-beta.11 and then the latest “rc0” version. what’s is this versioning convention? probably I’m in 2.0.0-beta.11 version, but ionic info says it’s 2.0.0-beta.20 as you can see.

if you run “npm show ionic@beta” you will see that there are more betas than 11 :smiley:

yeah, I get it now :wink: