Ionic 5 Events pass data while switching page

Yo devs,
I’m struggle with passing some data through Events while transition from one page to another:

export class Page1 implements OnInit {
  constructor(
    public events: EventsService
  ) {
    events.subscribe('appointment:test', (data: any) => {
        console.log(data)
    });
  }

:point_up: Of course I tried to put subscription inside ngOnInit and ionViewDidEnter

export class Page2 implements OnInit {
  constructor(
    public events: EventsService
  ) {}

  goBack() {
    let data = { test: 'test' }
    this.events.publish('appointment:test', data);
    this.navCtrl.navigateBack('page1');
  }

:point_up: Here I also tried to put publishing in ionViewDidLeave

I know that I can pass data through navigation but that way worked in previous Ionic version, would be nice to know why it not works anymore :slight_smile:

Also I’m sure that Events are working, when I publish while being on the same page works perfectly fine…

Thanks for any suggestion :bowing_man:

While you wait for better answers, I’d like to hear more about what you’re actually trying to do, because whatever it is, I bet there’s a categorically better way of going about it than Events.

Hi, since angular 7+ and ionic 4, It seems to me that Event is not recommended.
To navigate between page use Router from Angular routing
Are you try this ?