Skip to content

Commit

Permalink
docs: example code afterNextRender phase (#53025)
Browse files Browse the repository at this point in the history
Currently in the angular.dev documentation, afterNextRender function
take directly the phase as a second parameter which is not correct.
According to the api of this hook, the second parameter is an object
which contains the phase. This PR update the part of the documentation

PR Close #53025
  • Loading branch information
Nicoss54 authored and AndrewKushnir committed Nov 20, 2023
1 parent ed0fbd4 commit f84057d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions adev/src/content/guide/components/lifecycle.md
Expand Up @@ -257,12 +257,12 @@ export class UserProfile {
// Use the `Write` phase to write to a geometric property.
afterNextRender(() => {
nativeElement.style.padding = computePadding();
}, AfterRenderPhase.Write);
}, {phase: AfterRenderPhase.Write});

// Use the `Read` phase to read geometric properties after all writes have occured.
afterNextRender(() => {
this.elementHeight = nativeElement.getBoundingClientRect().height;
}, AfterRenderPhase.Read);
}, {phase: AfterRenderPhase.Read});
}
}
```
Expand Down

0 comments on commit f84057d

Please sign in to comment.