如何通过离子按钮点击进入另一个页面? [英] how to go to another page with a button click with ionic?

查看:13
本文介绍了如何通过离子按钮点击进入另一个页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试使用代码,我添加了按钮,但我不知道如何在单击它时将其链接到另一个页面.

I have been trying to work with the code, I added the button but I don't know how to link it to another page when clicking on it.

推荐答案

html:

 <ion-buttons>
   <button ion-button (click)="goAnOtherPage()">Go an Other Page </button>
 </ion-buttons>

 <ion-label  [navPush]="anOtherPage">Go an Other Page</ion-label>

在 TS 中:

import { NavController } from 'ionic-angular';
import { AnOtherPage } from '/anOtherPage';


anOtherPage: AnOtherPage;

 constructor(public navCtrl: NavController) {}

goAnOtherPage() {
  this.navCtrl.setRoot(anOtherPage);
}

这篇关于如何通过离子按钮点击进入另一个页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆