Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

32 Commits

Repository files navigation

EmberFire

Ember.js and Firebase Integration

This library provides a base Ember.js model that does the retrieving and syncing of your object's property to your specific Firebase location.

Installation

Just add the "emberfire.js" file in your html.

<scripttype="text/javascript" src="./emberfire.js"></script>

Example usage

Sample Firebase location data:

/myapp
- person
- firstName: "Juan"
- lastName: "Pedro"
- age: "17"
- address: "Manila"

[Step 1]
To have an Ember.js model that is Firebase-location-aware, you just have to extend the "EmberFire" model:

Person=EmberFire.extend({});

[Step 2]
Provide these properties to give default values:

  • locationUrl -- property to specify your firebase location.
  • isListItem -- default is false property to tell if this firebase location a list item or not.
  • listId -- needed if isListItem is set to true and it is already existing in the firebase location.
  • modelProperties -- property to enumerate the firebase location properties.
varfirebaseLocation="/myapp";Person=EmberFire.extend({locationUrl: firebaseLocation+"/person",modelProperties: ["firstName","lastName","age","address"]});

[Step 3]
Once you are done specifying this configuration you can "optionally" add your own properties to your Ember.js model and specify their default values:

Person=EmberFire.extend({locationUrl: firebaseLocation+"/person",modelProperties: ["firstName","lastName","age","address"]firstName: "",lastName: "",age: 0,address: ""});

[Step 4]
And then you can create an instance of your model and it will automatically sync any updates on your Ember.js model.

window.App=Ember.Application.create();App.person=Person.create();

If you want to delete the whole model on your Firebase location just call the "remove()" method.

App.person.remove();

About

Ember.js and Firebase Integration

Resources

Stars

17 stars

Watchers

4 watching

Forks

Releases

Packages

Used by

Contributors

Languages