I've been working on the problem for about a week now with no progress. I have an array of data that's available to my $scope
. I iterate through it like this:
<div ng-repeat="device in myData">
<label>{{processor(device.$id)}}</label>
</div>
The data contains only a Firebase $uid
. And I want to make a second request to the database to get information thats associated with this $uid
and place it as the label's content. I thought I could use an angular expression with a function to pass in the Firebase $uid
and return some data.
I declare this $scope
function:
$scope.processor = function(uid) {
function getDeviceInfo(callback) {
_.child('device/' + uid).once('value', function(snapshot) {
callback(snapshot.val())
})
}
getDeviceInfo(function(data) {
console.log(data)
return data
})
}
Basically I call the processor($id)
in my scope, passing in the uid
I want to lookup. The function getDeviceInfo()
runs and has a callback, when the data is returned, I log it to the console, which works perfect, all the data is there. But then when I try and return a value to the $scope
, it doesn't update.
I've tried about every combination of Angular/AngularFire code available and haven't gotten anything to work, any ideas?