Hi! I have a service in my app that makes use of localStorage. I tried making use of provide with an InjectToken to override it on the server, but I can't think of a solution on how to do it.
Running the app with this config, doesn't work, and I have no idea if this is even possible.
Can providers be overriden from an outside module?
Documentation seems to be pretty lacking on this subject.
The only way I can think of now, is to not import AppModule in AppServerModule, and
make the AppServerModule basically a copy of AppModule with different imports and providers.
But I'd like to avoid this method.
Hi! I have a service in my app that makes use of localStorage. I tried making use of provide with an InjectToken to override it on the server, but I can't think of a solution on how to do it.
AppModule looks like this:
LocalStorage is an InjectToken instance
export const LocalStorage = new InjectToken();
and in my server side code I have
ngExpressEngine
Running the app with this config, doesn't work, and I have no idea if this is even possible. Can providers be overriden from an outside module? Documentation seems to be pretty lacking on this subject.
The only way I can think of now, is to not import AppModule in AppServerModule, and make the AppServerModule basically a copy of AppModule with different imports and providers. But I'd like to avoid this method.
Any ideas? Thanks!