How to fire callback function from component scope right after alert is being dismissed

I need to fire some function on my page/component right after user clicks OK on an alert. Problem is, this alert is being handled by external service (our notificationService) so I can’t just set this callback as a button action because scope will be wrong (my service instead a component). How to solve that?

Instead firing my alert in notificationsService (alert.present()) I could return alert reference to a component and handle it there using alert.onDismiss() + alert.present() but maybe there is an another solution?


I think handling ui in a provider is an architectural flaw in your code.

But if you insist, you could consider the Events system.

And that way, make your code even more adrift from sound practice.



Yea, I think so too. I’ll rewrite it. That will be better :wink:

1 Like