-
Notifications
You must be signed in to change notification settings - Fork 12k
Creating a module with --route & --routing creates duplicated & errored code #17139
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
Comments
Hi @Maryannah, I tried this locally and while the second part is a bug, I was unable to reproduce the first issue with the steps provided. The resulted module looks like the below without the const routes: Routes = [
{ path: '', component: HomeComponent }
];
@NgModule({
declarations: [HomeComponent],
imports: [
CommonModule,
RouterModule.forChild(routes)
]
})
export class HomeModule { } |
@alan-agius4 I have followed the steps again and here is the result : If I remove the routing flag : It seems that the second (semi-colon) and third (schematics config not applied) issues are with my own repository, I will look into that myself ! I am removing them from my original issue |
Hi @Maryannah, can you please update the issue title and description accordingly as it seems that you deleted the details of the actual bug? Thanks. |
@alan-agius4 I have removed what is related to my own repository and kept the issue as it was found originally. I am adding a screenshot to picture it if needed, but that's all the issue, the duplication of the routes ! |
…o `RoutingModule` Prior to this commit, we defined routes in two places example: ```ts @NgModule({ declarations: [ HomeComponent ], imports: [ CommonModule, RouterModule.forChild(routes), HomeRoutingModule ] }) export class HomeModule { } ``` Closes angular#17139
…o `RoutingModule` Prior to this commit, we defined routes in two places example: ```ts @NgModule({ declarations: [ HomeComponent ], imports: [ CommonModule, RouterModule.forChild(routes), HomeRoutingModule ] }) export class HomeModule { } ``` Closes angular#17139
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. |
🐞 bug report
Affected Package
The issue is caused by the schematics that create a moduleIs this a regression?
I do not know, I have never tried it beforeDescription
when running a command to create a module with --route & --routing, the code gets duplicated : there are routes in the *.module.ts along with the *-routing.module.ts🔬 Minimal Reproduction
I didn't manage to create a stackblitz, but here are the commands to reproduce it locally.🌍 Your Environment
Angular Version:
Anything else relevant?
I do not know if this is wanted or not, and I do not know which one is the best practice (the one to keep).
Here is a picture of the issue, in case it helps : you can see routes on the module, but also a routing module that is imported with it.
The text was updated successfully, but these errors were encountered: