Skip to content

Instantly share code, notes, and snippets.

@rupurt
Created May 28, 2013 14:08
Show Gist options
  • Save rupurt/5663013 to your computer and use it in GitHub Desktop.
Save rupurt/5663013 to your computer and use it in GitHub Desktop.
Ember.js currentUser controller injection
Em.Application.initializer({
name: 'currentUser',
initialize: function(container) {
var store = container.lookup('store:main');
var currentUser = App.User.find('current');
container.register('user:current', currentUser, { instantiate: false });
container.injection('controller', 'currentUser', 'user:current');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment