In your example you don't need to pass any parameters. The pathFor
helper will automatically use the current data context and grab the property from that object. Since you have an {{#each articles}}
iterator, the current data context for pathFor
will be set to the current item in the list (an article). The article object should have an _id
property on it, so the path helper will just work. If you wanted to change the data context, you could pass another object as a first parameter to the pathFor
helper, or you could use the {{#with anotherDataContextObject}}
block helper.
In v0.5.4, you could also use the Handlebars hash key values to replace the context object. In the dev branch this is no longer true. If you provide key value pairs as parameters in your Handlebars helper, those will be appended to the query string. To illustrate here's an example for the change in dev branch:
{{pathFor 'article' article q=some+query}}
//=> "/article/abcd/?q=some+query
Or
{{#with article}}
{{pathFor 'article' q=some+query}}
//=> "/article/abcd/?q=some+query
{{/with}}
/article/abcd/?_id=abcd
. – Quadrennial