V
V
Vladimir2016-05-23 15:08:22
Angular
Vladimir, 2016-05-23 15:08:22

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

2 answer(s)
N
Nicholas, 2016-05-23
@healqq

1. getElementByIddefined only for document, inside the element you can use for example getElementsByTagNameor 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.

_
_ _, 2016-05-23
@AMar4enko

What did ngAnimate not please you, by the way? Allows you to animate styles, returns a promise. They told her how much to animate, subscribed to then - profit. And how many crutches are in it, so that it works more or less ok everywhere ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question