0
votes

In my ionic application, I am navigating to the pages using router.Navigate() method. I need to perform some activities on the routed page (page 2) however I am not able to get an event on page 2 which shall be triggered on router.Navigate() method from Page 1.

Page 2 was already accessed before navigating to page 1.

I have gone through few posts and blogs but seems like ionic life-cycle events does not hook to the routing event. I am not able to figure out a way to do this. I have also tried using all the life cycle event on page 2.

Navigation from Page 1:

this.router.navigate([argRoutingKey]);

1

1 Answers

0
votes

It can be catch ngOnInit

sending page

 constructor (private router: Router) {}
  onClick () {
    this.router.navigate(['/your_component', 'yourdata']);
  }

resiving page

ngOnInit()
        {
          console.log("ngOnInit")
        }