Skip to content

Commit

Permalink
Return object reference after adding via angularFireCollection
Browse files Browse the repository at this point in the history
  • Loading branch information
anantn committed Jun 6, 2013
1 parent 098326b commit bfb831c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions angularFire.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,13 @@ angular.module('firebase').factory('angularFireCollection', ['$timeout', functio
});

collection.add = function(item, cb) {
var ref;
if (!cb) {
collectionRef.ref().push(item);
ref = collectionRef.ref().push(item);
} else {
collectionRef.ref().push(item, cb);
ref = collectionRef.ref().push(item, cb);
}
return ref;
};
collection.remove = function(itemOrId) {
var item = angular.isString(itemOrId) ? collection[indexes[itemOrId]] : itemOrId;
Expand Down

0 comments on commit bfb831c

Please sign in to comment.