I have some dynamically created elements with a directive. I have to call a function from element’s directive in some cases. If I were created this elements statically, I would use @ViewChild (‘myElement’) myElement in the component and something like:
<div #myelement myDirective>...</div>in the HTML. However I couldn’t to that because I creating this elements dynamically (I don’t know such a method to give #myelement1, #myelement2, … tags dynamically). My idea was getting the elements with document.getElementById() but I couldn’t access the directive from native DOM element. Any idea how to access the directives of these elements without using @VievChild ()?