Skip to content

Instantly share code, notes, and snippets.

@jdjkelly
Created April 1, 2014 02:40
Show Gist options
  • Save jdjkelly/9906676 to your computer and use it in GitHub Desktop.
Save jdjkelly/9906676 to your computer and use it in GitHub Desktop.
Ember App Kit Initializer Example for Injecting Current User into Controllers
import Session from 'appkit/models/session';
export default Ember.Application.initializer({
name: 'currentUser',
initialize: function(container, app) {
// Register a new container
container.register('session:current-user', Session);
// Load the current user
container.lookup('session:current-user').find();
// Inject the container into the controller
// containername object name factory
app.inject('controller', 'currentUser', 'session:current-user');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment