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

Generate angular workspace/application with ChangeDetection onPush #21353

Closed
2 of 15 tasks
prabh-62 opened this issue Jul 16, 2021 · 2 comments
Closed
2 of 15 tasks

Generate angular workspace/application with ChangeDetection onPush #21353

prabh-62 opened this issue Jul 16, 2021 · 2 comments

Comments

@prabh-62
Copy link

🚀 Feature request

Command (mark with an x)

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

Description

User should be able to generate angular applications/libraries with change detection enabled.

  • npx @angular/cli@12 new web-apps --create-application false --changeDetection onPush
Unknown option: '--changeDetection'
Unknown option: 'onPush'

npx_angular_cli_change_detection

Describe the solution you'd like

Provide a flag to enable change detection

Describe alternatives you've considered

Manually edit

  • angular.json and append "changeDetection": "OnPush" under @schematics/angular:component for every workspace application/library
  • projects/<app>/src/app/app.component.ts and append changeDetection: ChangeDetectionStrategy.OnPush to @Component decorator
@alan-agius4
Copy link
Collaborator

This did come up when we discussed #21278.

We feel that this is trivial enough to do and doesn't warrant to be included as an extra option in the various schematics. The fact that this option in the application schematic is already ambiguous enough.

Remember that you can use the ng config command to set up the options.

ng new web-apps --no-create-application
ng config schematics.@schematics/angular:component.changeDetection OnPush
ng generate application app-one

@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 Aug 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants