Let's consider component structure:
appComponent > router-outlet (A, B, C) > a, b, c (According to selected one), where: A, B, C: Load dynamically a, b, c (dynamic component loaders) a, b, c: Dynamic loaded components
The purpose of this excercise is to be able to have a version of the component a, b, c for different registers (suppose users), so the information I enter at every form a,b,c is always available in memory per user.
I am using router-outlet to display a ViewContainerRef which creates instances of "child-routed" components, this means, if I want to have routes a, b, c, then I load them within router outlet by using A, B, C as components with just the ViewContainerRef, and then within each of them I load dynamic components a, b, c respectively (which are stored in a centralized service if not created previously), and before I leave the route I implement canDeactivate in order to detach the current view from the ViewContainer so the component instance of a,b,c is never destroyed and I can insert them on loader when I come back to that certain route for that certain user.
Is this a right approach? Or should I not definitely mix dynamic component loaders with router-outlet?
Update: What if I want to have one more router-outlet within a,b,c which takes me to c,d? i'm having problems because it seems to be unable to recognize router-outlets placed on a,b,c so the dynamic component loaders C, D are not displayed