0

I have a parent component that within that TS file I get the element ref as follows:

@ViewChild("custContainer") _custContainer: ElementRef;
const height = this._custContainer.nativeElement.height;

I then have a child component where I need to access this parent ElementRef. How can I do this in the child component and I believe I need to get it once the parent is rendered as I am using it to get the height once data is loaded into this element.

1 Answer 1

1

If you want to access the height inside the child component then you can use @Input property in the child component.

In child component

.ts

@Input() height;

And from the parent component html

<child-comp [height]="height"></child-comp>
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.