Skip to content

Conversation

cexbrayat
Copy link
Member

PR Checklist

Please check to confirm your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the new behavior?

ng g c no longer generates a component with the CommonModule import. This import is not useful if developers adopt the control flow syntax in their templates. Instead, developers are encouraged to import the individual directives/pipes if needed.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

…components

`ng g c` no longer generates a component with the `CommonModule` import.
This import is not useful if developers adopt the control flow syntax in their templates.
Instead, developers are encouraged to import the individual directives/pipes if needed.
@cexbrayat cexbrayat force-pushed the fix/remove-common-module branch from bb5300f to 9f15404 Compare November 22, 2023 13:01
@alan-agius4 alan-agius4 added target: patch This PR is targeted for the next patch release action: merge The PR is ready for merge by the caretaker labels Nov 22, 2023
@clydin
Copy link
Member

clydin commented Nov 22, 2023

I think it's also important to note that the Angular compiler will generate an actionable error message in the event that a developer attempts to use one of the directives with these changes. For example:

NG8103: The `*ngFor` directive was used in the template, but neither the `NgFor` directive
nor the `CommonModule` was imported. Use Angular's built-in control flow @for or make sure
that either the `NgFor` directive or the `CommonModule` is included in the `@Component.imports`
array of this component.

@alan-agius4 alan-agius4 merged commit 571722d into angular:main Nov 23, 2023
@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 Dec 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants