hello i'm trying combine data retrieved 3 different locations in firebase. data structured follows:
dashboard.data.post dashboard.data.post.image dashboard.data.post.audio dashboard.data.post.text
when user posts able make post underneath 1 of blocks. able search underneath block of users posts , retrieve information, combine all, ordered data post , display user. far method feel rudimentary , appreciate advice possible, if means restructuring data.
info.block = $firebasearray of id's users have of post info.text $firebasearray of texts post info.image $firebasearray of image post info.audio $firebasearray of audio post var storage = function(text, image, audio, value, liststore) { var postkey = value.postid; angular.foreach(info.text, function(curr, key) { if (postkey === curr.$id) { liststore.push(curr); return true; } }); angular.foreach(info.image, function(curr, key) { if (postkey === curr.$id) { liststore.push(curr); return true; } }); angular.foreach(info.audio, function(curr, key) { if (postkey === curr.$id) { liststore.push(curr); return true; } }); }; info.blog.$loaded().then(function() { info.text.$loaded().then(function() { info.image.$loaded().then(function() { info.audio.$loaded().then(function() { angular.foreach(info.blog, function(value, key) { storage(info.text,info.image,info.audio,value,this); }, $scope.randomobj); }); }); }); });
Comments
Post a Comment