1
I’m trying to understand how to navigate between pages with ionic2
. I want that by clicking the button below it redirect me to HomePage
, how can I do this?
Button in.html menu
<button ion-button color="light">Button</button>
My . ts
@Component({
selector: 'page-menu',
templateUrl: 'menu.html',
})
export class MenuPage {
constructor(public navCtrl: NavController, public navParams: NavParams, public alertCtrl: AlertController) {
}
showAlert() {
const alert = this.alertCtrl.create({
title: 'New Friend!',
subTitle: 'teste',
buttons: ['OK']
});
alert.present();
}
openSobre(){
this.navCtrl.push(HomePage, {}, {animate: true} );
}
ionViewDidLoad() {
console.log('ionViewDidLoad MenuPage');
}
}
I have my Menupage that is as root and I want to go to Homepage, in which . ts I put?
– SHRIMP
Your menu page is a page or side menu?
– jraspante
a page I put as root page
– SHRIMP
Got it. So through it you will call the Homepage page.
– jraspante
my Component already has @Component(' selector: 'page-home', templateUrl: home.html'}) , just add the selector: 'page-home', templateUrl: 'home.html in it?
– SHRIMP
Edit your question by asking how your Menupage.ts is doing
– jraspante
added, take a look
– SHRIMP
You already have the Homepage component created with the . ts and . html files?
– jraspante
Let’s go continue this discussion in chat.
– SHRIMP