Dan Kanze
Dan Kanze

Reputation: 18595

Save and Get $priority of item in Firebase collection AngularFire 0.6.0

Let's say I have a collection of items

var itemsRef = new Firebase("https://example.firebaseio.com/items");  
$scope.items = $firebase(itemsRef);

And I want to save a new item to the collection with a $priority

$scope.items["thing"] = {name:'The Thing'};
$scope.items["thing"].$priority = 1;
$scope.items.$save("thing");

So far so good - I can see the new item in my collection.

Now let's fetch it and figure out what $priority I just assigned to it:

var thingRef = new Firebase("https://example.firebaseio.com/items/thing");  
$scope.thing = $firebase(thingRef);
$scope.thing.$on("loaded", function() {
  console.log($scope.thing);
});

Which shows us our Firebase object in the console without a $priority assigned to it.

However if we do this:

//After saving the "thing" $priority
$scope.items.$on("loaded", function() {
  console.log($scope.items);
});

You will see the child node and its $priority

What is the correct way to both save and get priorities for a Firebase collection item?

Upvotes: 1

Views: 1076

Answers (1)

Dan Kanze
Dan Kanze

Reputation: 18595

This was a bug which has since been resolved: https://github.com/firebase/angularFire/issues/243

Upvotes: 0

Related Questions