Skip to content

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

Closed

Description

@anantanandgupta

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

Activity

  1. added a commit that references this issue on Dec 19, 2023
    478c754
  2. added
    freq1: low
    on Dec 19, 2023
  3. self-assigned this
    on Dec 19, 2023
  4. added 2 commits that reference this issue on Dec 19, 2023
    a1f3ae5
    3130043
  5. angular-automatic-lock-bot commented on Jan 19, 2024

    @angular-automatic-lock-bot

    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.

  6. locked and limited conversation to collaborators on Jan 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area: @schematics/angularfreq1: lowseverity5: regressiontype: bug/fix

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions