I'm trying to make one project with one router-outlet inside another router-outlet:
It will work like this:
In the first router-outlet it will have two views:
auth component (/login)
admin component (/admin)
Then in the second outlet will be inside the admin component, with its own routes, that will render these:
dashboard (/admin)
profile (/admin/profile)
users (/admin/users)
Now, in the Angular 2 docs, I can see they have this implementation using modules. But I don't want to use multiple modules (or I have to?).
Is there a way to make this implementation without separating modules?
I want a default component for the admin area, that is why I wanted the second router-outlet, for example: The dashboard will have the HeaderComponent, LeftNavComponent, and the DashboardCompoent. But the profile page will have all these HeaderComponent and LeftNavComponent too, and the only thing that would change is the ProfileComponent, so it will have basically the same structure. I think I don't need to repeat every importing for every different admin page. I wanted to have just one main admin component, that will have a dynamic content based on the current route.
I already tried and searched in the internet a lot, but the only example I could find is from the official Angular 2 documentation. But they are implementing this with multiple modules.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…