I am working with an AngularJS 1.7.2 component that includes several nested components:
| parent
| - child
| - - child1
| - - child2
Within the parent component, I need to access the child1 component, specifically where the template starts with <div id="child-1">
, and attach event listeners. Here is an example code snippet from the parent component:
$ctrl.$onInit = () => {
$element.find('#child-1').addEventListener()
};
The issue is that $element.find('#child-1') returns undefined because the child1 component is not yet attached to the DOM.
Is there a way to wait until all child elements are bound to the DOM?
Thank you!