Cross component event handling in Ionic2

Does anyone know what the recommended way of creating cross-component events is in an Ionic2 app?

Let’s say I have a button on a page and when that button is clicked I want an event to run in another page/controller. What’s the method now for subscribing to an event that is fired in another component?

1 Like

Ok, I think I found out how - the Angular2 EventEmitter (I think)

1 Like

From a purely Angular standpoint, you have two options: event emitters or using a service that both components consume.

I’m still pretty new to Ionic 2 and Angular 2 so there might be a better way baked in.

You can use the Ionic2 Events as well. https://github.com/driftyco/ionic/tree/2.0/demos/events

1 Like

thank you for showing this https://ionicframework.com/docs/v2/api/util/Events/ :grin:
similiar like $rootScope in ionic 1 :grinning: