如何在Ionic2中以编程方式更改ion-title [英] How can I change ion-title programmatically in Ionic2
本文介绍了如何在Ionic2中以编程方式更改ion-title的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的Ionic2项目中,我有三个选项卡的标签视图:
In my Ionic2 project I have tabbed view with three tabs:
tabs.ts
<ion-navbar *navbar>
<ion-title>My tab parent title</ion-title>
</ion-navbar>
<ion-tabs>
<ion-tab [root]="tab1Root" tabIcon="people"></ion-tab>
<ion-tab [root]="tab2Root" tabIcon="person"></ion-tab>
<ion-tab [root]="tab3Root" tabIcon="globe"></ion-tab>
</ion-tabs>
有谁知道如何以编程方式更改 ion-title $来自其中一个子选项卡的此页面的c $ c>?
Does anyone know how I can programmatically change the ion-title
of this page from one of the child tabs?
推荐答案
我是这样做的:
<ion-header>
<ion-navbar>
<ion-title>{{title}}</ion-title>
</ion-navbar>
</ion-header>
<ion-tabs>
<ion-tab [root]="tabLogin" tabTitle="Login" tabIcon="log-in" (ionSelect)="this.title ='Login'"></ion-tab>
<ion-tab [root]="tabSignup" tabTitle="Sign up" tabIcon="add-circle" (ionSelect)="this.title ='Sign up'"></ion-tab>
</ion-tabs>
这篇关于如何在Ionic2中以编程方式更改ion-title的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文