Bug ionic 4

I have one bug when i cklick back the page , page.ts he don’t execute
whyyy??

ngOnInit() {

      
      this.storage.get('id').then((res)=>{
        if(res) {
          
          this.router.navigate(['espace-client']);
        }
        
      });
        
      
  }

this code don’t execut when click back

what do you mean by that? code you provided navigates to ‘espace-client’ if and only if there is a ‘id’ key in storage. By the way, perhaps you meant 'escape-client instead of espace-client?

this code in home.ts
i testing when user login and click home page tab he redirect to page espace-client
that execut first time , when click back he don’t redirect to espace-client , i should to refresh page for executing

Have a look to the DOM. Wrapped Navigation with ionic4 is a little different comparing with only angular router. Pages are hidden and not destroyed. So if you open the page again ngOnInit is not performed because the component was only hidden. You can see this in the Dom inspector.
For what I know this is not documented and so this could open many problems.
So the solution is do use ionic hooks instead of ngInit

Can you give me example for this issue

I solved problem with ionViewWillEnter it’s perfect :grinning:

ionViewWillEnter (){
 
  this.storage.get('id').then((res)=>{
    if(res) {
      
      this.router.navigate(['/espace-client']);
    }
    
  });
}

I believe the problem was actually that your URL was missing the slash at the beginning (/espace-client) and not that you had to call it from ionViewWillEnter() :slightly_smiling_face:

If you will read more about the navigation stack and the comparison to the angular router you can read this

I’m really wondering why the ionic team never do a blog about this, this is really a big thing IMO