AngularJS - Simulate .prev() using jqLite only?

angularjs, jquery

Solution

You can also use native DOM api to get previous/next sibling:

var prevNode = element[0].previousElementSibling;
var prev = angular.element(prevNode); // optional

var nextNode = element[0].nextElementSibling;
var next = angular.element(nextNode); // optional

Problem

In `angular.element` there is only a `next()` method but `prev()`. Is there any way to simulate the behavior of `prev()` with Angular/jqLite only?

Original source