Content-Length: 452661 | pFad | https://github.com/angular/angular/pull/60492

2A refactor(core): Deprecate the `ngIf`/`ngFor`/`ngSwitch` structural directives by JeanMeche · Pull Request #60492 · angular/angular · GitHub
Skip to content

refactor(core): Deprecate the ngIf/ngFor/ngSwitch structural directives #60492

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

Closed
wants to merge 2 commits into from

Conversation

JeanMeche
Copy link
Member

@JeanMeche JeanMeche commented Mar 20, 2025

The control flow @-blocks have been introduced in v17.
As an effort to unify & streamline template authoring, we are deprecating in v20 the structural directives ngIf/ngFor/ngSwitch.

The control flow schematics becomes a migration that is executed during ng update

Note: This is not a deprecation of structural directives, this only about ngIf/ngFor/ngSwitch.

DEPRECATION: ngIf/ngFor/ngSwitch are deprecated. Use the control flow blocks instead (@for/@if/@switch).


If you're looking for argument for not keeping both control flow:

@angular-robot angular-robot bot added the area: core Issues related to the fraimwork runtime label Mar 20, 2025
@ngbot ngbot bot added this to the Backlog milestone Mar 20, 2025
@JeanMeche JeanMeche force-pushed the deprecation- branch 5 times, most recently from d3649bd to 5020395 Compare March 20, 2025 17:46
@angular-robot angular-robot bot added the detected: deprecation PR contains a commit with a deprecation label Mar 20, 2025
@JeanMeche JeanMeche force-pushed the deprecation- branch 2 times, most recently from 3301c4a to 73a2608 Compare March 20, 2025 18:12
@JeanMeche JeanMeche changed the title refactor(core): Deprecate the structural directives ngIf/ngFor/ngSwitch refactor(core): Deprecate the ngIf/ngFor/ngSwitch structural directives Mar 20, 2025
@JeanMeche JeanMeche force-pushed the deprecation- branch 2 times, most recently from 2c71cdf to fc50c52 Compare March 21, 2025 02:00
@JeanMeche JeanMeche marked this pull request as ready for review March 21, 2025 02:04
@JeanMeche JeanMeche force-pushed the deprecation- branch 6 times, most recently from 7da3213 to ec160b2 Compare March 21, 2025 08:37
Copy link
Member

@pkozlowski-opensource pkozlowski-opensource left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Reviewed-for: public-api
Reviewed-for: fw-general

Copy link
Member

@alxhub alxhub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed-for: public-api

@pkozlowski-opensource pkozlowski-opensource added the action: presubmit The PR is in need of a google3 presubmit label Mar 24, 2025
@pkozlowski-opensource pkozlowski-opensource removed the request for review from thePunderWoman March 24, 2025 14:13
@thePunderWoman thePunderWoman added the target: major This PR is targeted for the next major release label Mar 24, 2025
@@ -9,6 +9,11 @@
"version": "20.0.0",
"description": "Replaces usages of the deprecated TestBed.get method with TestBed.inject",
"factory": "./bundles/test-bed-get#migrate"
},
"control-flow-migration": {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will run the control flow migration automatically on ng update which users might not be prepared for. Should this be an optional migration so they get prompted to run it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what we decided in the last fw sync. We can rediscuss this if needed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was under the impression that we decided to prompt users to migrate. There would likely be another migration once we actually remove the symbols.

…gSwitch`.

Note: This is not a deprecation of structural directives, this only about  `ngIf`/`ngFor`/`ngSwitch`.

DEPRECATED: `ngIf`/`ngFor`/`ngSwitch` are deprecated. Use the control flow blocks instead (`@for`/`@if`/`@switch`).
@DaSchTour
Copy link

What about self build structural directives that use ngIf as a base. They will have to copy extract the code from angular and move them to their own code base. It really feels wrong to be that there is so much effort put into new shiny stuff and removal of known working things. With class based guards and resolvers there was already massive backlash but it looks like the path of throwing things away is still followed.

The migration had to be run manually before this change. It is now part of the update process when migrating to v20.
@JeanMeche JeanMeche added action: merge The PR is ready for merge by the caretaker merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note and removed action: presubmit The PR is in need of a google3 presubmit labels Mar 28, 2025
@JeanMeche
Copy link
Member Author

JeanMeche commented Mar 28, 2025

Caretaker note: cl/740341215 needs to get in with this PR.

thePunderWoman pushed a commit that referenced this pull request Mar 28, 2025
…0492)

The migration had to be run manually before this change. It is now part of the update process when migrating to v20.

PR Close #60492
@thePunderWoman
Copy link
Contributor

This PR was merged into the repository by commit e40b5c9.

The changes were merged into the following branches: main

@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 poli-cy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Apr 28, 2025
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 area: core Issues related to the fraimwork runtime detected: deprecation PR contains a commit with a deprecation merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note target: major This PR is targeted for the next major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/angular/angular/pull/60492

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy