Skip to content

docs: use inject() in @Self example in hierarchical DI guide#68383

Open
erkamyaman wants to merge 1 commit intoangular:mainfrom
erkamyaman:docs-adev-self-modifier-use-inject
Open

docs: use inject() in @Self example in hierarchical DI guide#68383
erkamyaman wants to merge 1 commit intoangular:mainfrom
erkamyaman:docs-adev-self-modifier-use-inject

Conversation

@erkamyaman
Copy link
Copy Markdown
Contributor

The surrounding @SkipSelf and @host examples already use inject(), and the section intro recommends it. Align the @self example to match.

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?

The @Self() example in the "Resolution modifiers" section of the hierarchical DI guide uses constructor-based injection (constructor(@Self() public flower: FlowerService) {}), while the section intro recommends using each modifier in the inject() configuration, and the surrounding @SkipSelf and @Host examples (and the other @Self example in the same section) already use the inject() form.

Issue Number: N/A

What is the new behavior?

The @Self() example now uses inject(FlowerService, {self: true}), matching the surrounding examples and the section's stated guidance. The dedicated "Modifiers with constructor injection" subsection still documents the legacy decorator-based form.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

The surrounding @SkipSelf and @host examples already use inject(),
and the section intro recommends it. Align the @self example to match.
@pullapprove pullapprove Bot requested a review from bencodezen April 26, 2026 09:32
@angular-robot angular-robot Bot added the area: docs Related to the documentation label Apr 26, 2026
@ngbot ngbot Bot added this to the Backlog milestone Apr 26, 2026
Copy link
Copy Markdown
Member

@JeanMeche JeanMeche left a comment

Choose a reason for hiding this comment

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

Thanks for catching this

@JeanMeche JeanMeche added action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release labels Apr 26, 2026
@JeanMeche JeanMeche removed the request for review from bencodezen April 26, 2026 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: docs Related to the documentation target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants