Skip to content

Instantly share code, notes, and snippets.

@janmisek
Created May 21, 2015 09:20
Show Gist options
  • Save janmisek/e74f333283bb508d0e76 to your computer and use it in GitHub Desktop.
Save janmisek/e74f333283bb508d0e76 to your computer and use it in GitHub Desktop.
Get router handlers in emberjs
// returns infos with model and parameters for each route
getRouterInfos: function() {
var router = this.get('router');
var infos = router.router.currentHandlerInfos.slice();
// normalize latest. because it is e.g. 'streams.index'
var latest = infos[infos.length-1];
var names = latest.name.split('.');
latest.name = names[names.length-1];
return infos;
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment