Nickon
Nickon

Reputation: 10156

Get ElementRef to the children from lower levels

I know I can use @ViewChild to get a reference to some child of current component:

@ViewChild('someInput') someInput: ElementRef;

And inside the HTML part:

<input #someInput />

But what if I wanted to get a reference for the same input but that is inside a component which stands couple levels "lower"?

<component1>
   <component2>
      <component3>
         <input #someInput />
      </component3>
   </component2>
</component1>

Suppose, we want to get a ref to #someInput inside component1.ts. Is it possible?

Upvotes: 1

Views: 764

Answers (1)

Related Questions