today i was working on how to navigate from one page to another page using ionic 2 and angular code in typscript, the answer is very simple by using this inside your class.
here is an example
TYPESCRIPTimport { Component } from '@angular/core';
import { NavController, NavParams } from 'ionic-angular';
import { QuizPage } from '../quiz/quiz';
/*
Generated class for the Next page.
See http://ionicframework.com/docs/v2/components/#navigation for more info on
Ionic pages and navigation.
*/
@Component({
selector: 'page-next',
templateUrl: 'next.html'
})
export class NextPage {
constructor(public navCtrl: NavController, public navParams: NavParams) {}
ionViewDidLoad() {
//console.log('ionViewDidLoad NextPage');
}
showNextPage(){
//alert('ShowHomePage');
this.navCtrl.setRoot(QuizPage);
}
}
HTML: <button ion-button (click)="showNextPage()">Quiz Page</button>