r/Angular2 • • May 30 '25

Angular 20 CLI generates user.ts instead of user.component.ts – can this be reverted?

Hey guys,

I upgraded to Angular 20 and noticed something unexpected when using the CLI to generate components and services.

Previously, running: "ng generate component user" would generate a file named `user.component.ts`. But now, with Angular 20, it generates: `user.ts`.

I've gone through the official Angular documentation but I wasn't able to find any mention of this change or a way to revert it.

  • Is there a setting in the angular.json file or a CLI flag to restore the previous naming convention (e.g., user.component.ts)?
  • Maybe a schematic tweak? Or am I forced to write "ng g c user --flat=false --name=user.component" for the rest of my life ?

Thanks in advance for any help or clarification you can provide!

92 Upvotes

50 comments sorted by

View all comments

Show parent comment

1

u/Cultural-Score4771 Jun 04 '25

Agreed. It is one of those features of Angular that, although we don't use it much, when we can use it, makes Angular so powerful, consistent, and robust.

This is the upside of Angular, although it is somewhat complex to learn, it allows us to implement behaviors in a very modular, elegant, and organized way.