Skip to content
This repository was archived by the owner on Oct 22, 2020. It is now read-only.

Commit 61f0987

Browse files
committed
Use angular.forEach for compatibility
1 parent 9762ebe commit 61f0987

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

angular.tree.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,17 +123,15 @@
123123
(function() {
124124
var listChildren = listElem.children();
125125

126-
for (var i = 0; i < listChildren.length; i += 1) {
127-
var child = angular.element(listChildren[i]);
128-
126+
angular.forEach(listChildren, function (child) {
129127
if (newList.indexOf(tree.getItem(child.scope())) < 0) {
130128
child.remove();
131129
}
132-
}
130+
});
133131
})();
134132

135133
(function () {
136-
newList.forEach(function (item, index) {
134+
angular.forEach(newList, function (item, index) {
137135
var listChildren = listElem.children(); // TODO don't do this ever loop iteration
138136

139137
if (index >= listChildren.length) {
@@ -159,7 +157,6 @@
159157

160158
angular.module('angularTree', []).
161159
directive('ngTree', function ($compile, $document) {
162-
163160
return {
164161
compile: function (elem, attrs) {
165162
var tree = initTree(elem, attrs, $compile, $document);

0 commit comments

Comments
 (0)