Unexpected token while trying to inject NavController


#1

`import {Page, NavController} from ‘ionic-framework/ionic’;
import {Signup} from ‘…/signup/signup’;
import {Pass} from ‘…/pass/pass’

@Page({
templateUrl: ‘build/pages/login/login.html’
})
export class Login {
constructor(nav: NavController){

}

goTosignup(){
this.nav.push(Signup)
}

}

Dependency injection is not working, i get this error


Ionic 2.0 navigation error
#2

This has been answered on other thread.

Check This discussion here

Basically, nav: NavController is used in TypeScript and you are only using Javascript.
If you got that from example scattered on internet, probably those example are based on older build of Ionic2.

Cheers.


#3

solved my issue many thanks


#4

It was error due to changing the ionic 2 beta specification, earlier beta version using the typescript. Now its move on with babel JS you have to inject controls as following way

export class Login {
static get parameters(){
return [[NavController]];
}
constructor(nav){
this.nav = nav;
}
}