angularjs - Accessing nested data with Angularfire -
i trying capture changes nested array in firebase data. info laid out so:
calls (unique firebase id) station: "foobar" time: "20:30" responders (unique firebase id) name: "frank" avatar: "foo.jpg" (unique firebase id) name: "martha" avatar: "bar.jpg"i need maintain track of when calls changed , when responders added or removed. struggling tracking responders phone call - not have random ids ahead of time, need track in real time calls , responders each phone call change.
here have far. code related paths , getting jwt missing-
var ref = new firebase('https://foobar.firebaseio.com/clients/' + clientauth); var callref = ref.child('calls'); $scope.activecalls = 0; $scope.calls = $firebase(callref); $scope.calls.$on("change", function() { var keys = $scope.calls.$getindex(); $scope.activecalls = keys.length; keys.foreach(function(key, i) { console.log($scope.calls[key].responders); // provides object array of responders }); });
update
i remembered child_added
regular firebase.. came this. more eloquent way appreciated, trying maintain more angular based.
$scope.calls.$on("child_added", function(v) { console.log(v.snapshot.value); // gives me details need });
angularjs firebase angularfire
No comments:
Post a Comment