I have a service
with this function :
this.addSubject = function(categId, data){
$firebase(url.child('discussions').child(categId)).$push(data).then(function (newChildRef) {
console.log("added record with id " + newChildRef.key());
});
};
And I call the function in my Controller
. But I want to recover the new id newChildRef.key()
, to use it in my Controller
. But if I make a return, there is nothing.
Is there a way to save this id
?
Or is it possible to call other function of my service in this function ?