|
300 | 300 | * `changesObj` is a hash whose keys are the names of the bound properties that have changed, and the values are an
|
301 | 301 | * object of the form `{ currentValue, previousValue, isFirstChange() }`. Use this hook to trigger updates within a
|
302 | 302 | * component such as cloning the bound value to prevent accidental mutation of the outer value.
|
303 |
| - * * `$doCheck()` - Called on each digest cycle. Provides an opportunity to detect and act on |
| 303 | + * * `$doCheck()` - Called on each turn of the digest cycle. Provides an opportunity to detect and act on |
304 | 304 | * changes. Any actions that you wish to take in response to the changes that you detect must be
|
305 |
| - * invoked from this hook; implementing this has no effect on when `$onChanges` is called. |
| 305 | + * invoked from this hook; implementing this has no effect on when `$onChanges` is called. For example, this hook |
| 306 | + * could be useful if you wish to perform a deep equality check, or to check a Date object, changes to which would not |
| 307 | + * be detected by Angular's change detector and thus not trigger `$onChanges`. This hook is invoked with no arguments; |
| 308 | + * if detecting changes, you must store the previous value(s) for comparison to the current values. |
306 | 309 | * * `$onDestroy()` - Called on a controller when its containing scope is destroyed. Use this hook for releasing
|
307 | 310 | * external resources, watches and event handlers. Note that components have their `$onDestroy()` hooks called in
|
308 | 311 | * the same order as the `$scope.$broadcast` events are triggered, which is top down. This means that parent
|
@@ -2505,6 +2508,9 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
|
2505 | 2508 | if (isFunction(controllerInstance.$doCheck)) {
|
2506 | 2509 | controllerInstance.$doCheck();
|
2507 | 2510 | }
|
| 2511 | + if (isFunction(controllerInstance.$doCheck)) { |
| 2512 | + controllerInstance.$doCheck(); |
| 2513 | + } |
2508 | 2514 | if (isFunction(controllerInstance.$onDestroy)) {
|
2509 | 2515 | controllerScope.$on('$destroy', function callOnDestroyHook() {
|
2510 | 2516 | controllerInstance.$onDestroy();
|
|
0 commit comments