-
Notifications
You must be signed in to change notification settings - Fork 11.9k
angular cli is generating a standalone component when it is generating with module #26700
Description
Command
generate
Is this a regression?
- Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
16.x
Description
while generating a lazy loading module from command line tool, the generated component is marked as standalone by default, while there is no option to flag this component to be generated as a normal component.
Minimal Reproduction
below command generates a standalone component when generating a module
ng g m moduleName --routing -m app --route module-name
output as
CREATE applications/go-live/src/app/modules/module-name/module-name-routing.module.ts (360 bytes)
CREATE applications/go-live/src/app/modules/module-name/module-name.module.ts (387 bytes)
CREATE applications/go-live/src/app/modules/module-name/module-name.component.scss (0 bytes)
CREATE applications/go-live/src/app/modules/module-name/module-name.component.html (26 bytes)
CREATE applications/go-live/src/app/modules/module-name/module-name.component.ts (218 bytes)
UPDATE applications/go-live/src/app/app-routing.module.ts (1131 bytes)
I have to modify the angular.json -> schematics -> @schematics/angular:component -> standalone to false to make is possible, but that impact the global component generation.
since the standalone component generation is default now, but we have a choice when we a generating the component only with a flag --standalone or --no-standalone.
i am considering this a bug as i seems that this use case was not thought through when angular team decided to make the standalone components as the default for the component generation.
Exception or Error
none
Your Environment
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 17.0.6
Node: 20.10.0
Package Manager: yarn 1.22.19
OS: darwin x64
Angular: 17.0.6
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
... service-worker
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1700.6
@angular-devkit/build-angular 17.0.6
@angular-devkit/core 17.0.6
@angular-devkit/schematics 17.0.6
@schematics/angular 17.0.6
rxjs 7.8.1
typescript 5.2.2
zone.js 0.14.2
Anything else relevant?
No response