Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 544df18

Browse files
gscoppinogkalpak
authored andcommitted
docs(guide/component): document $doCheck in the component guide
The docs for `$compile` were updated in e235f20 to include information about the recently implemented `$doCheck` lifecycle hook for component controllers. The lifecycle hook documentation is mirrored in the Component guide, and this change mirrors the update made to the `$compile` docs, to the component guide docs. Closes #14946
1 parent b4769c3 commit 544df18

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

docs/content/guide/component.ngdoc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,12 @@ of the component. The following hook methods can be implemented:
160160
are the names of the bound properties that have changed, and the values are an object of the form
161161
`{ currentValue, previousValue, isFirstChange() }`. Use this hook to trigger updates within a component such as
162162
cloning the bound value to prevent accidental mutation of the outer value.
163+
* `$doCheck()` - Called on each turn of the digest cycle. Provides an opportunity to detect and act on
164+
changes. Any actions that you wish to take in response to the changes that you detect must be
165+
invoked from this hook; implementing this has no effect on when `$onChanges` is called. For example, this hook
166+
could be useful if you wish to perform a deep equality check, or to check a Date object, changes to which would not
167+
be detected by Angular's change detector and thus not trigger `$onChanges`. This hook is invoked with no arguments;
168+
if detecting changes, you must store the previous value(s) for comparison to the current values.
163169
* `$onDestroy()` - Called on a controller when its containing scope is destroyed. Use this hook for releasing
164170
external resources, watches and event handlers.
165171
* `$postLink()` - Called after this controller's element and its children have been linked. Similar to the post-link

0 commit comments

Comments
 (0)