8000 fix(core): inject migration should treat @Attribute as optional by RussellSprouts · Pull Request #60916 · angular/angular · GitHub
[go: up one dir, main page]

Skip to content

fix(core): inject migration should treat @Attribute as optional #60916

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 1 commit into from

Conversation

RussellSprouts
Copy link

The @Attribute decorator will inject null if a host attribute is missing, but inject(new HostAttributeToken(...)) will throw a no provider error. We should set {optional: true} when migrating an @Attribute decorator. Also allow nonNullableOptional to add ! to those declarations if enabled.

PR Checklist

Please check if 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
  • angular.dev application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

8000

@pullapprove pullapprove bot requested a review from devversion April 18, 2025 16:57
@angular-robot angular-robot bot added the area: core Issues related to the framework runtime label Apr 18, 2025
@ngbot ngbot bot added this to the Backlog milestone Apr 18, 2025
@AndrewKushnir AndrewKushnir requested review from crisbeto and removed request for devversion April 18, 2025 17:10
The @Attribute decorator will inject null if a host attribute
is missing, but `inject(new HostAttributeToken(...))` will throw
a no provider error. We should set {optional: true} when migrating
an @Attribute decorator. Also allow nonNullableOptional to add
`!` to those declarations.
@crisbeto crisbeto added action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release target: major This PR is targeted for the next major release and removed target: patch This PR is targeted for the next patch release labels Apr 18, 2025
@pkozlowski-opensource
Copy link
Member

This PR was merged into the repository by commit 0162ceb.

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 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 May 23, 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 framework runtime target: major This PR is targeted for the next major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0