Event subscription disappeared after upgrading to ionic 5

I was using this to subscribe for a Topic in ionic 4. But now since it is no longer existing in ionic 5, I am wondering how to subscribe to a topic instead.

   this.event.subscribe('country:created', data => {
              this.countryName = data.country;

You should really read the Migration Guide and Breaking Changes if you upgrade Major Versions of anything! Ionic Events are removed in ionic 5. See here.

So you can’t longer subscribe or use events. If you need something like this, i advise you to create your own Service, which handles this through Observables.

1 Like