I am currently exploring firebase and attempting to retrieve data using this service from firebase instead of json files. However, I have encountered some challenges in getting it to function properly. This is inspired by the angularjs phonecat example
.factory('Article', ['$resource', FIREBASE_URL, $firebaseArray,
function ($resource, FIREBASE_URL, $firebaseArray) {
var ref = new Firebase(FIREBASE_URL + "articles");
var posts = $firebaseArray(ref);
return $resource('views/:articleId', { }, {
query: {method:'GET', params:{articleId: 'articles'}, isArray:true}
});
}]);
Here are the controller functions:
.controller('blogCtrl', ['$scope', 'Article',
function($scope, Article){
$scope.articles = Article.query();
}]);
.controller('blogpageCtrl', ['$scope','$routeParams','Article',
function($scope, $routeParams, Article){
$scope.article = Article.get({articleId: $routeParams.articleId}, function(article){
});
}]);