I believe the answer to this is "no", but is there a method/service in Angular where I can pass in a component's root DOM node (e.g. <foo-component>
) and receive the component instance (e.g. FooComponent
)?
I couldn't find an associated SO post on this.
Example:
<foo-component id="foo"></foo-component>
const fooElement: HTMLElement = document.getElementById('foo');
const fooInstance: FooComponent = getInstanceFromElement(fooElement);
Is there a method in Angular like getInstanceFromElement
?
from Get Angular component class from DOM element
No comments:
Post a Comment