Firebase binding use $q in AngularJS
Develop in LiveScript
It also has great readibility and lots of syntax sugar just like you're writting python/ruby.
Use new API from $q
We use newly introduced $q API to
notify you about the value/order changes, we let you decide how you deal with your data with
Firebase Collection support
We know that you want to take advantage of collection in
Firebase, but still want to preserve the right order, or order by any properties in each item.
ng-fire-alarm allows to transform collection object into native js array for you.
Seperation of Concerns
We follow seperation of concerns by seperating control(reference) object and data source to
Alarm object and
Fire object(s). So a
ng-click can be directly bound to Alarm object, while your Fire object(s) are clean and just like what you see in Firebase dashboard.
Just use it
Then include them through script tag in your HTML.
Rails projects (Only support 3.1+)
Add this line to your application's Gemfile:
And then execute:
Then add these lines to the top of your
And include in your
angular module definition:
We add a new method to
The key to transform your
Firebase reference into a
AngularJS powered alarm object, it take one parameter:
Pass true will transform collection object into native js array for you.
A wrapped object over Firbease reference that is returned by calling
$promise: it will be notified everytime the value/order changes.
$thenNotify: Same as
$promise.then(void, void, callback).
Register a callback that notify you each time the alarm rings.
$promise.then, this method is self-chained and will return alarm object to allow chaining.
See examples below.
Ther're wrapper for
Firebase.prototype.limit/startAt/endAt function, but it'll update internal Firebase reference and it'll populate new data through your callback registered via
They're wrapper for
Firebase.prototype.remove/push/update/set/setPriority/setWithPriority function, but it'll return a
promise object instead of passing in a callback function.
Object that is passed in to callbacks registered via
$thenNotify, they can be primitive, object, or array:
Primitive is just js primitive. There's NO NO NO wrapper around primitive
we've add two properties on it:
sorted by native Firebase ordering.
Each item in array, if they're object, will have these properties:
- Fork it ( https://github.com/tomchentw/ng-fire-alarm/fork )
- Create your feature branch (
git checkout -b my-new-feature)
- Commit your changes (
git commit -am 'Add some feature')
- Push to the branch (
git push origin my-new-feature)
- Create new Pull Request