Skip to content
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

angular cli is generating a standalone component when it is generating with module #26700

Closed
1 task done
anantanandgupta opened this issue Dec 18, 2023 · 1 comment · Fixed by #26708
Closed
1 task done
Assignees
Labels
area: @schematics/angular freq1: low Only reported by a handful of users who observe it rarely severity5: regression type: bug/fix

Comments

@anantanandgupta
Copy link

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

alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Dec 19, 2023
…sing `ng generate module`

Adjust the module schematic to always generate non standalone components.

Closes angular#26700
@alan-agius4 alan-agius4 added type: bug/fix freq1: low Only reported by a handful of users who observe it rarely severity5: regression area: @schematics/angular labels Dec 19, 2023
@alan-agius4 alan-agius4 self-assigned this Dec 19, 2023
alan-agius4 added a commit that referenced this issue Dec 19, 2023
…sing `ng generate module`

Adjust the module schematic to always generate non standalone components.

Closes #26700
alan-agius4 added a commit that referenced this issue Dec 19, 2023
…sing `ng generate module`

Adjust the module schematic to always generate non standalone components.

Closes #26700

(cherry picked from commit a1f3ae5)
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jan 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: @schematics/angular freq1: low Only reported by a handful of users who observe it rarely severity5: regression type: bug/fix
Projects
None yet
2 participants