mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
docs: example code afterNextRender phase (#53025)
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
This commit is contained in:
committed by
Andrew Kushnir
parent
ed0fbd4071
commit
f84057d366
@@ -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});
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user