Skip to content

Instantly share code, notes, and snippets.

@stavarotti
Last active October 8, 2015 15:28
Show Gist options
  • Save stavarotti/c5d61649dc617ee967a9 to your computer and use it in GitHub Desktop.
Save stavarotti/c5d61649dc617ee967a9 to your computer and use it in GitHub Desktop.
generate a dynamic url in Ember
_generateUrl(routeName, dynamicSegments, queryParams) {
const router = this.get('router');
const args = [ routeName ].concat(dynamicSegments);
if (queryParams) {
args.push({ queryParams });
}
const url = router.generate(...args);
if (url[0] === '#') {
return url.substring(1);
}
return url;
}
//return this.get('container').lookup('router:main’);`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment