Skip to content

Commit

Permalink
add
Browse files Browse the repository at this point in the history
  • Loading branch information
genesistms committed May 13, 2022
1 parent 68c42b7 commit e42290d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class AfterChangesComponent implements AfterChanges {

// #docregion ng-after-changes
ngAfterChanges() {
changeLog.add('Input property has changed.');
changeLog.add('Input property has changed. ($power)');
}
// #enddocregion ng-after-changes

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
11 changes: 5 additions & 6 deletions src/guide/lifecycle-hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -419,12 +419,11 @@ The host `AfterChangesParentComponent` binds to them like this:
<after-changes [hero]="hero" [power]="power"></after-changes>
```

<!-- TODO: migrate -->
<!-- Here's the sample in action as the user makes changes. -->
<!-- <img class="image-display" src="{% asset ng/devguide/lifecycle-hooks/on-changes-anim.gif @path %}" alt="AfterChanges"> -->
<!-- The log entry appear as the string value of the *power* property changes. -->
<!-- But the `ngAfterChanges` does not catch changes to `hero.name` -->
<!-- That's surprising at first. -->
Here's the sample in action as the user makes changes.
<img class="image-display" src="{% asset ng/devguide/lifecycle-hooks/after-changes-anim.gif @path %}" alt="AfterChanges">
The log entry appear as the string value of the *power* property changes.
But the `ngAfterChanges` does not catch changes to `hero.name`
That's surprising at first.

Angular only calls the hook when the value of the input property changes.
The value of the `hero` property is the *reference to the hero object*.
Expand Down

0 comments on commit e42290d

Please sign in to comment.