I've done this 100 times before but I'm getting some quirky function from a simple Iron Router link.
I've got my link set up:
<a href="{{pathFor 'templateName' this.pathId }}">Show</a>
But no link is appearing. Not even with incorrect info. Nada.
So I thought it must have an incorrect data context. But I put:
{{this.pathId}}
Right next to the link and it's giving me back the correct ID.
Furthermore, I hacked it a bit and made the link trigger an event with Router.go using this.pathId, and it worked fine.
Just the helper is giving me problems.
Any help would be appreciated. I'm probably missing something easy. It's late. I'm on Meteor 1.0.3 and Iron Router 1.07
Replace to this.
<a href="{{pathFor 'templateName' _id=this.pathId }}">Show</a>
or change this.pathId
to this._id
.
This could be another solution.
//this will work if you have the href tag inside a `{{#each}}`
Template.example.helpers({
'templateName' : function(){
return "templateName" + this.pathId;
}
})
and use it like this
<a href="{{pathFor templateName}}">Show</a>
Also you can ended up doing this.
<a href="/templateName{{this.pathId}}">Show</a>