Closed niranjans closed 9 years ago
I found the answer. Adding it here for others:
// returns '/posts/1'
Router.routes['postDetail'].path({_id: 1});
// returns 'http://localhost:3000/posts/1'
Router.routes['postDetail'].url({_id: 1});
I really don't see why this isn't in the Guide, or anywhere else in the documentation. Sorry to bump an old thread, but could we please see this included in the docs? I came close to guessing this, but didn't think to name the params passed into .url().
for any one coming later adding to @niranjans answer you could also set query params as follows
Router.routes['postDetail'].path({_id: 1},{query:{q1:v1}});
Router.routes['postDetail'].url({_id: 1},{query:{q1:v1}});`
This seems to be a very simple thing and I think I'm missing something here but I can't seem to find how to get the complete URL to a particular page in Javacript similar to pathFor / urlFor.
I tried looking for this in the docs and the issues but couldn't get anything.