Is there any way to get the height of components such as nz-header,nz-breadcrumb?

Angular uses nz-zorro, hoping to get the height of the nz-header component, using the following methods:

<nz-header style="background: -sharpfff; padding:0;" -sharpheader>
  <i class="trigger" nz-icon [type]="isCollapsed?"menu-unfold":"menu-fold"" (click)="isCollapsed=!isCollapsed"></i>
</nz-header>

@ViewChild("header") header: ElementRef;

console.log(this.header.nativeElement.offsetHeight);

in this way, the code will report an error. Header does not have the attribute of nativeElement. How can I get the height of the nz-header component?
Thank you.

Jun.22,2022

Please manipulate the template variable in the correct life hook.

try

ngAfterViewInit(){
    console.log(this.header.nativeElement.offsetHeight);
}
Menu