Reputation: 4407
I'm setting up a body helper for use with Iron Router to use as {{route}}
:
Template.body.helpers({
route: function(){
alert(Router.current().route.getName());
}
});
But Router.current().route.getName()
returns undefined instead of "/thirdPage/".
Upvotes: 3
Views: 2959
Reputation: 194
Router.current().route.path()
Works fine until you have routes with parameters, at which point it suddenly retuns
null
making it pretty unreliable in my opinion.
Iron.Location.get().path
Seems to be the most reliable method at the moment for getting your path with parameters (not the complete url including "http://" as Router.current().url does)
Upvotes: 2
Reputation: 582
I use:
Router.current().url
This gets whatever is in your url bar, FYI
Router.current().params.yourParamName
This will get the content of your parameter
Upvotes: 1