Skip to content

Generate components in angular workspace/application with ChangeDetection onPush #21523

Open
@prabh-62

Description

@prabh-62

🐞 Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • extract-i18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

N/A

Description

One should be able to generate angular application with changeDetection.OnPush components.

🔬 Minimal Reproduction

  • npx @angular/cli@12 new web-apps --create-application false
  • cd web-apps
  • yarn ng config schematics.@schematics/angular:component.changeDetection OnPush
  • yarn ng generate application admin-dashboard --prefix ad --routing --style css
  • Review generated projects/admin-dashboard/src/app/app.component.ts and there is no changeDetection set.

🔥 Exception or Error

angular_workspace_no_change_detection

🌍 Your Environment


Angular CLI: 12.2.0
Node: 16.6.1
Package Manager: yarn 1.22.10
OS: darwin x64

Angular: 12.2.0
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1202.0
@angular-devkit/build-angular   12.2.0
@angular-devkit/core            12.2.0
@angular-devkit/schematics      12.2.0
@schematics/angular             12.2.0
rxjs                            6.6.7
typescript                      4.3.5

Anything else relevant?

  • yarn ng generate component components/home --project admin-dashboard and changeDetection is set to onPush for generated projects/admin-dashboard/src/app/components/home/home.component.ts

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions