Firebase's AngularFire in an AngularJS service
The best way of handling Firebase in AngularJS surely has to be from within a service, so it's available to all Controllers across the App. I just can't get it to work! ... I first tried using angularFire(new Firebase(url)) , hoping I could bind to the service's scope, but Angular complains that it cannot $watch it. So I tried angularFireCollection instead like this: app.factory('myService', function myService(angularFireCollection) { var url = 'https://myfirebase.firebaseio.com'; return { getAll: function(path) { var ref = angularFireCollection(new Firebase(url + '/' + path)); console.log(ref