Created
October 9, 2015 23:26
-
-
Save StephenFluin/78651116e9ba922e0d9c to your computer and use it in GitHub Desktop.
Firebase Join Tool
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// I'd love a mixin capability where I supply a route | |
// This route has an object of id=>true's, and for each ID we map on another route | |
// And save it as the data on the object. | |
app.factory("Mixer", ['$firebaseAuth', '$firebaseObject', | |
function($firebaseAuth, $firebaseObject) { | |
var mixer = function(sparseList, verboseList) { | |
var sparseRef = FB.child(sparseList); | |
var verboseRef = FB.child(verboseList); | |
var list = $firebaseObject(sparseRef); | |
list.$loaded(function() { | |
for(var key in list) { | |
if(key[0] === '$' || key === "forEach") { | |
continue; | |
} | |
list[key] = {data: $firebaseObject(verboseRef.child(key))}; | |
} | |
}); | |
return list; | |
}; | |
return mixer; | |
}]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment