New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(NgModule) consider removing the need to list every routing-component in declarations #10472
Comments
I added an export in my routes with an array of all my components, saves importing again in bootstrap however still a pain to maintain. |
I already wondered which components need to be added to the module. Since every component has it's own dependencies I don't quite get why there is a need of redeclaring everything in this module definition. |
This is the biggest breaking change of the new NgModule - Architecture: Starting from RC.6 components will not have there own dependencies, but dependencies will have to be managed on a Module-Level. RC-5 already works like this, but supports using |
lazy loading |
@choeller I hope that is not the case. That will be a huge change and tons of refactoring.... I thought RC was meant to be fairly stable. |
I added my thoughts on all this in #10552 |
@damiandennis well, currently it is case - there is some controversy going on around this fact, so if you want to you can express your concerns here: #10552 ;) |
How do we do hot module reloading with this requirement? |
This is unfortunate. I find Ng2 now becoming more and more complex to build with. What exactly was wrong with the previous way of doing it? I can't possibly see my self/team going forward with ng2 if this is the intended direction... |
Please add a repro |
If it bugs you that much, then you could always declare your routes in your module, so then you don't need 2x import statements. |
No repro => Closing this issue. |
@choeller it's their flawed way of quickly cleaning up issues so they have less to deal with. |
It will cause error 'Component declared in more than one module' in paths with |
@choeller I was under the impression that you do not need to add your components to the |
If you don't put the component to the
When you remove the
Given the strange way of organizing code in that plunker, I can see why you would get the impression that declaring the components isn't necessary. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
I'm submitting a ... (check one with "x")
Current behavior
Before
NgModules
I only had to import my routes in the routes config:after upgrading to NgModule I need to import this whole list once again in my bootstrap-file / MainModule:
This is quite a lot of copy paste...
Expected/desired behavior
I would assume, that when I pass the routing-config to the RouterModule, it should be possible for Angular to add the Routing-Components (like
DashboardComponent
) automatically to the module.Whereas for other Directives the NgModule-approach means less work, for Routing-Components it currently means more work than before. So it would be cool to reduce the need of copy-pasting here.
Please tell us about your environment:
The text was updated successfully, but these errors were encountered: