docs: clarify ngDoCheck invocation behavior with OnPush strategy#68825
Merged
Conversation
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
JeanMeche
approved these changes
May 20, 2026
Member
|
caretaker note: This is a doc only change, no need to presubmit |
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The previous documentation for
DoCheck/ngDoCheckimplied that the default change-detector had run on the directive itself, which is misleading.ngDoCheckis actually invoked when the parent's change-detector checks the directive's input bindings — meaning it fires even forOnPushcomponents whose own change detection was skipped.Updated three places in lifecycle_hooks.ts:
Fixes #48140