Use of Alert in an API Service class

Hi, is it possible to show an Alert (Ionics component) from a Service class that does have a @Page and no NavController import, or a templateUrl?

I have an API Service that other Services uses to pull data. In this API Service class I want to show automated error messages if the API for some reason sends an error.

The Alert component and currently seems only presentable via via the NavComponent.present(alert). Which is not available in my API Service.

Did you check out Dialogs and Dialogs.alert(...)?

That requires the device, so during simple testing with “ionic serve” it’s not available.

I’d really like to use Ionics component version as it serves the purpose best during testing at least.

You could call a function to initialize the service before using it - and in the init function pass in a NavController that could be used to present the alert.