Skip to content

Instantly share code, notes, and snippets.

@limptwiglet
Created July 4, 2012 13:57
Show Gist options
  • Save limptwiglet/3047493 to your computer and use it in GitHub Desktop.
Save limptwiglet/3047493 to your computer and use it in GitHub Desktop.
Ember Router
Z.Router = Ember.Router.extend({
root: Ember.Route.extend({
showInventory: Ember.State.transitionTo('inventory'),
showSkills: Ember.State.transitionTo('skills'),
close: Ember.State.transitionTo('index'),
exit: function (router) {
console.log('exit', arguments);
},
index: Ember.Route.extend({
route: '/'
}),
inventory: Ember.Route.extend({
route: '/inventory',
connectOutlets: function (router) {
router.get('applicationController').connectOutlet({
name: 'inventory',
context: Z.store.find(Z.Item)
});
},
closeInventory: Ember.State.transitionTo('index')
}),
skills: Ember.Route.extend({
route: '/skills',
connectOutlets: function (router) {
router.get('applicationController').connectOutlet({
name: 'skills',
context: Em.Object.create({})
});
}
})
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment