firebase - What is the equivalent of firebaseRef.push() with angularfire? -


in following non-angularfire pseudo-code expect have firebase generate key new data being pushed in.

var ref = firebase(...); var newref = ref.push({"blah":"blah"}); var autokey = newref.name(); 

i try same thing through angularfire bound model gives me errors object not having push() method, similar this question. got working when data type array.

how nice behaviour i've seen in regular firebase (non-angularfire) automatic keys objects?

if want use object , have auto-generated keys, use add method on angularfirecollection. example:

function examplecontroller($scope, angularfirecollection) {   var url = 'https://angularfireexample.firebaseio-demo.com/';   $scope.examples = angularfirecollection(url);   $scope.addexample = function(ex) {     $scope.examples.add(ex);   }; } 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -