Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70432

Tab navigate not trigger ionViewDidEnter

$
0
0

@soo wrote:

I create an Ionic 4 tab app.
Then generate a new page name second-page.
I use tab1 as main page, then add button navigate to second-page, add a back button at second-page to go back to main page, as below in html:

<ion-buttons slot="start">
  <ion-back-button defaultHref="/"></ion-back-button>
</ion-buttons>

I add function ionViewDidEnter() for both pages for testing, as below:

ionViewDidEnter() {
    console.log('ionViewDidEnter.....');
  }

When the app start, the console shows that main page trigger the ionViewDidEnter function, navigate to second page, the ionViewDidEnter is triggered too. So far so good.

Then I click the back button, the ionViewDidEnter function at the main page is not triggered. Why?

Using router navigate at second-page ts file is not working too:
this.router.navigate(['tabs/tab1']);

It navigate to tab1, but the ionViewDidEnter did not triggered.
If navigate between tabs, from tab2 or tab3 to tab1, the function is working fine.
I know it’s ionic page life cycle theory, but I just can’t figure it out.
Someone help. Thanks in advance.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70432

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>