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)
});
}
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');
}
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
Also I’m sure that Events are working, when I publish while being on the same page works perfectly fine…
Thanks for any suggestion
2 posts - 2 participants