Skip to content
This repository was archived by the owner on Mar 17, 2025. It is now read-only.

Commit 4041dad

Browse files
committed
Merge pull request #139 from pkaminski/patch-1
Don't remove first child if id missing from collection.
2 parents b37d301 + 1564695 commit 4041dad

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

angularfire.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,8 +267,10 @@ angular.module("firebase").factory("angularFireCollection", ["$timeout",
267267
// Remove an item from the local collection.
268268
function removeChild(id) {
269269
var index = indexes[id];
270-
collection.splice(index, 1);
271-
indexes[id] = undefined;
270+
if (index !== undefined) {
271+
collection.splice(index, 1);
272+
indexes[id] = undefined;
273+
}
272274
}
273275

274276
// Update an existing child in the local collection.

0 commit comments

Comments
 (0)