Get sub page or child page name in tabs page

#1

I am wondering how to get the sub page or child page name from Tabs page. I have searched a lot. I got `this.navCtrl.getActive() but unfortunetely this returns me the current tab name. My secnario is as follows:
From tabs page i am in Page A (Home page) and from Page A i went to Page B. My question is how i will i get the current page name(which is Page B) in Tabs.ts. Any help will be appriciated.

#2

This should answer your question :blush:

getSelected();
//Returns: Tab
//Returns the currently selected tab

EDIT: Im not sure but:
Do you mean that PAGE B isn’t a Tabpage at all ? And you want to replace the Tabname PAGE A to PAGE B ?

If so you need to pass parameters to Tabs.ts when entering PAGE B and replace the strings.

As quick example how it could look like:

HTML:
<ion-tab [root]="tab1Root" tabTitle="{{TAB1}}" tabIcon="ios-home"></ion-tab>

TS TABS

export class TabPage{
  TAB1 = "PAGE A"; 
  //This string is to replace when you push a parameter.
}

NavParams Doc:

#3

Thanks for the response @cherry. Page B is actually the child page or sub page of tabs page. I want the current sub page name (which is page B) if app is cold start.

#4

Hi @amitchandra008,
did you find any solution for this problem ? I am facing the same issue in my application, it’d be really helpful for me if you have any solution for this issue.
Thanks

#5

I think a desire for this information indicates a design flaw. What are you actually trying to achieve? Perhaps it can be done in a more maintainable way.