New Features in EmberFire

Hi, I’m Tim! I’m the newest member of the Firebase UX Team. I’ve been an avid Ember user for two years, and I’ve spent my first few weeks at Firebase adding new features to EmberFire. On the UX team, I’ll be working on building out features in the App Dashboard.

EmberConf 2015
EmberConf 2015

Last week Sara and I attended EmberConf 2015 in Portland, Oregon. We had a great time meeting a ton of awesome people in the Ember community and hearing about what’s coming up for Ember in 2015. After getting feedback from many of you, today we’re releasing some new features in EmberFire, our official bindings for EmberJS.

As Ember development moves towards Ember CLI, the latest release includes much better CLI support - you can easily install EmberFire as a CLI addon and the FirebaseAdapter will automatically be initialized in your application adapter. This release also adds support for querying your Firebase data. Details on both new features are below. Also, a special thanks to Matt Sumner for his contributions to this release on GitHub.

Improved CLI Support

EmberFire now supports ES6 modules and is packaged as an Ember CLI addon by default. You can get started with EmberFire in your CLI app in two steps:

1. Install EmberFire

From your CLI app’s directory, run the command:

$ ember install emberfire

This will add Firebase as a dependency in your bower.json file and generate app/adapters/application.js for you.

2. Add your Firebase URL

The ApplicationAdapter generated by running the install command references the config.firebase variable in your config/environment.js file. Next, update your Firebase URL to that file:

$ firebase: 'https://YOUR-FIREBASE-NAME.firebaseio.com/'

Now your Firebase data will automatically be synced with the Ember Data store.

The latest release also loosens our Ember Data requirement. You can use EmberFire with Ember Data beta-11 through beta-14.x.

You can run our example blog app by running ember serve from the root of the emberfire/ directory.

For those of you who aren’t using Ember CLI yet, don’t worry - you can still use EmberFire! Just include EmberFire and it’s dependencies in your HTML from our CDN. Check out the instructions in our guide for details.

Querying Data in Firebase

When we released additional querying methods, many of you asked for direct support for this in EmberFire. This 1.4.1 release includes findQuery support! You can now use Ember’s findQuery method to order your Firebase data by a specified child or by key. Using this sample Firebase of dinosaur facts as an example, the following query will return the two tallest dinosaurs:

//app/routes/dinosaurs.js
export default Ember.Route.extend({
    model: function() {
        return this.store.find('dinosaur', {
            orderBy: 'height',
            limitToLast: 2
        });
    }
});

Check out the EmberFire documentation on findQuery for more details.

We’d like your feedback!

Finally, we’d like to hear what you think as we continue to improve EmberFire. We encourage you to submit a PR on GitHub, and share your feature requests with us @Firebase on Twitter or in the comments below. We’re excited to see what you build with Firebase and Ember!