Skip to content

Instantly share code, notes, and snippets.

@katowulf
Created August 8, 2014 20:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save katowulf/cba7e5215e5d30e1a185 to your computer and use it in GitHub Desktop.
Save katowulf/cba7e5215e5d30e1a185 to your computer and use it in GitHub Desktop.
app.controller('ctrl', function(posts, $scope) {
var postId = 'post123';
posts.$loaded(function() {
$scope.post = posts.$getRecord(postId);
});
});
app.factory('Posts', function(FIREBASE_URL, Firebase, $firebase) {
var ref = new Firebase(FIREBASE_URL + 'posts');
return $firebase(ref).$asArray();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment