I'm having some real issues navigating between pages with Angular2 / Ionic2
If I try and push to a new page using the following code:
import {Page, NavController} from 'ionic-angular';
import {HomePage} from '../home/home';
@Page({
templateUrl: 'build/pages/login/login.html'
})
export class LoginPage {
static get parameters() {
return [[NavController]];
}
constructor(nav) {
this.nav = nav;
}
goHome() {
this.nav.push(HomePage);
}
}
I receive an error stating:
"push" is not a function
If I try a different tact and try and set homepage as the root like so:
import {IonicApp, Page, NavController} from 'ionic-angular';
import {HomePage} from '../home/home';
@Page({
templateUrl: 'build/pages/login/login.html'
})
export class LoginPage {
static get parameters() {
return [[IonicApp], [NavController]];
}
constructor(app, nav) {
this.app = app;
this.nav = nav;
}
goHome() {
let nav = this.app.getComponent('nav');
nav.setRoot(HomePage);
}
}
I receive an error stating:
"app" is not defined
Please could somebody give me some pointers? Thanks in advance