I've the following code:
<ul>
{{#each title}}
<li><a href="{{pathFor 'tplTitle'}}">{{this}}</a></li>
{{/each}}
</ul>
"title" is an array of strings: ["A title","Another title","End title"]
The router's code:
this.route("tplTitle", {
path:"/title/:sometitle",
data: function(){
return [... a search using "sometitle" argument ...]
})
The problem: {{pathFor 'tplTitle'}} returns an empty string, even if I put in the path: "/title/:this" (it weird, but maybe works :P).
In the docs, I cannot found information about this problem with pathFor :(
How can I do this?
- EDIT -
I found this solution:
<li><a href="{{pathFor 'article' _id=this._id }}">{{title}}</a></li>
source: How to pass a parameter to pathFor in Handlebars for Iron-Router with Meteorite?
And it works! But its this solution elegant?