Determine platform in app.module?

Is it possible for me to pick up the platform in app.module.ts i.e so I could inject a certain value into a provider if running on a device and a different value if running in a browser?

I currently have something like this:

{ provide: MY_PROVIDER, useValue: { provider_value } }

so in the example above I could instead have two values - one called client_value and one called web_value and which one I use is determined by the platform?

Or is there another way of doing this?

There is a method called getPlatform() in capacitor, which you could use to determine whether the App is running in a certain platform.

1 Like

I think you are looking for dynamic injection

Maybe look up the latest api