I want to be able to use my angular app both as regular webapp and as electron app. Electron app sometimes needs slightly different functionality (e.g some libraries don't work in the electron environment). I was thinking about creating some sort of PlatformElectron module, which will override some providers for the environment. But at this point I'm not sure if I'm looking for a correct thing. Anybody did something similiar?
#Overriding providers for different platforms/environments
3 messages · Page 1 of 1 (latest)
https://angular.dev/guide/di/dependency-injection-providers#factory-providers-usefactory
You could do this and return the appropriate service depending on your environment
With this approach I'll need to do that for every provider, while I'm looking for sort of a global solution. Like I want to be able to declare all dependencies specific to the platform in the one place (module)