Update for a better question:
I was able to get the factory running properly and have it total a number out of the loop. Now I'm having trouble getting that number to show up in the view and having that number show up every time a new item is added/removed/updated in the list.
The "ListWithTotal" factory works exactly like in the documentation. I wasn't properly setting the ref variable.
Here's the latest relevant code:
//controller
$scope.total = TodoService.getTotalPoints();
//service
var todos = $firebase(ref, {arrayFactory: "ListWithTotal"}).$asArray();
return {
getTotalPoints:function(){
todos.$loaded().then(function() {
total = todos.getTotal();
console.log(total);
return total;
});
},
I can't get this to return total to the view or update when the points value change. Can anyone please provide some direction?