You know firebase.com? You love angularJS? You played with angularFire before?
Well, I did so as well, and was somehow disappointed with the way angularFire is written, so I rolled my own. I believe that this is more straight forward in design, and it fixes some of the issues angularFire is struggling with (and hopefully doesn't introduce new ones!)
As angularFire it provides two objects, xcFire and xcFireCollection. Usage is easy: include xcFirebase.js within your html.
xcFire serves you with implicit update of your data, means your data is live updated and always in sync. It takes three parameters:
- an instance of Firebase or an URL to your data
- your $scope
- name of the variable on your $scope where your data will go to
xcFire('path-to-mydata', $scope, 'data').then(function() { //--> init your data editing here, and only here }
xcFireCollection gives you more control over when your data is updated, as you have to explicitly tell it to do so. It takes two parameters, of which the second is optional.
- an instance of Firebase or an URL to your data
- a function to be executed when your data is loaded.
xcFireCollection('path-to-mydata', function() { //--> to stop a loading indicator previously started, for example }
use it to add an item to your firebase
use it to update an item within your firebase
deletes an item from your firebase. It takes the item or an id as its param.
returns the index of an id within the collection
returns the item for the given id
- implementation as a provider to centralize firebase binding (maybe)
MIT