Answer the question
In order to leave comments, you need to log in
How to get the htmlNode of the current component in the component controller?
Here is an example codepen.io/anon/pen/XdvaaE
For some reason, the reference to $element[0] inside the element controller gives an object, instead of htmlNode, respectively, the getElementById method is undefined. How can I get the HTML node of the current component with all the methods ?
Answer the question
In order to leave comments, you need to log in
1. getElementById
defined only for document
, inside the element you can use for example getElementsByTagName
or querySelector
.
2. htmlNode is the interface that the HTMLElement has , which is given to you
3. if you need access to the DOM inside the controller, you've probably gone wrong somewhere.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question