Artem Platonov Artem Platonov - 6 months ago 22
Javascript Question

AngularJS implement element's before method without jQuery

Is there a simple way to implement before method for DOM manipulation without jQuery in my AngularJS directive?

jQuery way is:

$element.before($insertedBeforeElement);

Answer

To do it without jQuery but with angular's jqLite:

$element.parent()[0].insertBefore($insertedBeforeElement[0], $element[0]);
Comments