Skip to content

docs: clarify ngDoCheck invocation behavior with OnPush strategy#68825

Merged
leonsenft merged 1 commit into
angular:mainfrom
arturovt:docs/issue_48140
May 20, 2026
Merged

docs: clarify ngDoCheck invocation behavior with OnPush strategy#68825
leonsenft merged 1 commit into
angular:mainfrom
arturovt:docs/issue_48140

Conversation

@arturovt
Copy link
Copy Markdown
Contributor

The previous documentation for DoCheck / ngDoCheck implied that the default change-detector had run on the directive itself, which is misleading. ngDoCheck is actually invoked when the parent's change-detector checks the directive's input bindings — meaning it fires even for OnPush components whose own change detection was skipped.

Updated three places in lifecycle_hooks.ts:

  • Interface description: scopes "the check" to input bindings in the parent template and adds an explicit OnPush callout.
  • "detects changes" clarified to "detects changes to the directive's input bindings".
  • Method description: "after the default change-detector runs" → "after the default change-detector has checked the directive's input bindings in the parent template".

Fixes #48140

The previous documentation for `DoCheck` / `ngDoCheck` implied that the
default change-detector had run on the directive itself, which is
misleading. `ngDoCheck` is actually invoked when the *parent's*
change-detector checks the directive's input bindings — meaning it fires
even for `OnPush` components whose own change detection was skipped.

Updated three places in lifecycle_hooks.ts:
- Interface description: scopes "the check" to input bindings in the
  parent template and adds an explicit OnPush callout.
- "detects changes" clarified to "detects changes to the directive's
  input bindings".
- Method description: "after the default change-detector runs" →
  "after the default change-detector has checked the directive's input
  bindings in the parent template".

Fixes angular#48140
@angular-robot angular-robot Bot added the area: docs Related to the documentation label May 20, 2026
@ngbot ngbot Bot added this to the Backlog milestone May 20, 2026
@JeanMeche JeanMeche added merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release labels May 20, 2026
@JeanMeche
Copy link
Copy Markdown
Member

caretaker note: This is a doc only change, no need to presubmit

@leonsenft leonsenft marked this pull request as ready for review May 20, 2026 18:11
@leonsenft leonsenft merged commit ca44055 into angular:main May 20, 2026
12 of 15 checks passed
@leonsenft
Copy link
Copy Markdown
Contributor

This PR was merged into the repository. The changes were merged into the following branches:

@arturovt arturovt deleted the docs/issue_48140 branch May 20, 2026 18:14
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 merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ngDoCheck hook has a bit misleading documentation

3 participants