We have an Angular app that we are converting to standalone. After some trial and error everything went fine, except for a single case.
We have a component that asks the user for some data confirmation. This happens usually every two years. Clearly we don't want to load this component every time.
The component itself is loaded inside a dialog, but it has some state and some effects. Now, to provide state and effects I need an EnvironmentInjector (as ProvideEffects returns an EnvironmentProvider), but I can't use providers array in bootstrapApplication as it is global, and I haven't a route, as the component is loaded inside a dialog, no matter what is the page selected.
the angular guide (https://angular.io/guide/standalone-components#environment-injectors) says
So I think the only option left is to create an EnvironmentInjector with CreateEnvironmentInjector. This, from what I have understood, would imply injecting an ApplicationRef to get the root injector and pass it as parent to CreateEnvironmentInjector. I don't know if this is possible with provideEffects, or if there is a canonical way to do this, or simply a better way. Could someone point me in the right direction?