Skip to content

Instantly share code, notes, and snippets.

@machty
Created July 19, 2014 21:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save machty/fd227c0262af3790eec3 to your computer and use it in GitHub Desktop.
Save machty/fd227c0262af3790eec3 to your computer and use it in GitHub Desktop.
this is a backwards compatible approach to namespace-less nested routes.
Router.map(function(root) {
// this === root
this.route("articles", function(scope) {
// this === scope, hence making `scope` an optional
// arg unless you have some reason to use it within callbacks below
// these two are identical and generate a route
// named "articles.show"
this.route("show");
//scope.route("show");
// but if you want to declare a route that doesn't
// get namespaced, you can use `root`
root.route("comments");
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment