How does angularfire .$save() compare to firebase .push()? I know push() will generate a unique key when data is stored, but I can't recreate the behavior using angularfire. Is there a way or should I be using .push() and if so, in what case would you use $save()?
Here is one sample I have using $save()...
var fb = new Firebase(FIREBASE_URI).child('Test');
var article = $firebaseObject(fb);
article.Foo = "bar";
article.$save().then(function(fb) {
console.log(fb.key() === article.$id); // true
}, function(error) {
console.log("Error:", error);
});
And another using .push()...
var article = new Firebase(FIREBASE_URI).child('Articles');
article.push({
title: $scope.article.title,
post: $scope.article.post
}, function(error) {
if (error) {
console.log("Error:", error);
}
});
What are the Pros/Cons and use cases for both?