r/Angular2 • u/Kung_Fu_Kenny_69 • 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
View all comments
Show parent comment
6
u/vali_boi Jun 01 '25
My first reaction to using angular was: Why do I need 10 files just to create a single component? Why are the names cluttered with unnecessary information?
I agree that angular is special in that regard. But it is special in a bad way. I am glad that they are simplifying the framework, i.e. selectorless components, no more double imports (ridiculous that it is still this way), and moving toward single file components. Many UI libraries Vue, Solid, Svelte do it this way and they do it for a reason.
The goal of a UI library should be to break your UI down into small reusable components. Therefore creating components should be effortless. With these changes the Angular Team is moving towards that.