From bfb831ca1e703d28c8f186e031a97001511f2348 Mon Sep 17 00:00:00 2001 From: Anant Narayanan Date: Thu, 6 Jun 2013 11:46:15 -0700 Subject: [PATCH] Return object reference after adding via angularFireCollection --- angularFire.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/angularFire.js b/angularFire.js index de3226df..3f803c23 100644 --- a/angularFire.js +++ b/angularFire.js @@ -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;