Reputation: 307
I'm starting with angular and the next question comes up.
In the component, app.component.html is where I have a navigation and some more elements that are common to all routes. But now I want to create a part of the administrator that has to use neither the navigation nor the other elements. But others that I have created.
My question is: Can I create another file type "app.component" for the administration part with its own structure and that has nothing to do with the other party?
Upvotes: 0
Views: 143
Reputation: 2862
You don't need another "app.component", you probably just want to create another module for admin utilities and routing. That way your app.component is just the parent for the whole application.
app.component will be in the main app.module.ts file, then you can create two child modules that are both imported into the app.module.
for example
The point is to modularize sections of your application. That way your admin module can live separately from everything else and will not rely on any dependencies that the user.module does. And vice versa.
In addition, this opens up lazy loading options, specialized route guards per module, etc... I recommend reading over NgModules on the angular docs.
You'll notice at the end of that doc there are links for different module "types":
What you're asking for is two different feature modules with their own entry components and services
Upvotes: 1