Could there be a function that always triggers when a component is displayed in an ionic2 app?
For example, I've noticed that the constructor
function in a component only triggers when the component is initialized for the first time or when you navigate to it from a different page using push
.
However, the constructor will not trigger when the user clicks the back
button or switches between tabs
.
Is there a method that will be called every time the component is shown on the screen?
Update
After some research (which basically means googling ;)), I discovered that each tab maintains its own history stack. For instance, if I have tabs for home
and search
, any navigation actions in the search
tab are isolated from the home
tab.
So, here's what I want to achieve:
- Perform a search in the
search tab
- Click on the search button in the
search tab
- Redirect to the
home tab
without displaying the search results again in thesearch tab
itself
I hope this clarifies my requirement a bit more