Ionic2 "this.nav.push is not a function"


#1

Hallo, i started my advanture with Ionic2. I’m to Ionic Framework. I wanted to learn navigation between pages, but i recived this error:

TypeError: this.nav.push is not a function
at HomePage.goToResult (http://localhost:8100/build/main.js:52668:18)
at CompiledTemplate.proxyViewClass.View_HomePage0.handleEvent_11 (/AppModule/HomePage/component.ngfactory.js:158:34)
at CompiledTemplate.proxyViewClass.<anonymous> (http://localhost:8100/build/main.js:91655:37)
at HTMLButtonElement.<anonymous> (http://localhost:8100/build/main.js:36596:36)
at t.invokeTask (http://localhost:8100/build/polyfills.js:3:9723)
at Object.onInvokeTask (http://localhost:8100/build/main.js:34667:37)
at t.invokeTask (http://localhost:8100/build/polyfills.js:3:9659)
at e.runTask (http://localhost:8100/build/polyfills.js:3:7083)
at HTMLButtonElement.invoke (http://localhost:8100/build/polyfills.js:3:10836)

my line of code looks like this:

`  goToResult(barcodeData) {
      this.nav.push(ScannerResultPagePage); 
   }`

So what is cousing the problem?

@UPDATE:

ok, project started to works magicly :confused:


#2

Did you import nav into your component/page and inject it as part of the constructor?

e.g.

import { NavController } from 'ionic-angular';

export class SomePage {
	constructor(public nav: NavController) {}
}