Skip to content

Instantly share code, notes, and snippets.

@gcollazo
Last active August 29, 2015 14:04
Show Gist options
  • Save gcollazo/34dddf5f526155e6e004 to your computer and use it in GitHub Desktop.
Save gcollazo/34dddf5f526155e6e004 to your computer and use it in GitHub Desktop.
Super simple example initializer for ember-cli, injected to all routes.
import Ember from 'ember';
var RegistrationManager = Ember.Object.extend({
signup: function(email, password) {
console.log('Register:', email, password);
}
});
export default {
name: 'registration',
initialize: function(container, app) {
app.register('reg:main', RegistrationManager);
app.inject('route', 'reg', 'reg:main');
}
};
/*
Now on routes you can use this as
this.reg.signup('user@example.com', 'abc123');
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment