I'm reading guide of Ember.js templates. In the handlebar part of the first example of above link, they used
{{#linkTo posts.post post}}
but I thought
{{#linkTo posts.post}}
would work.
Why do I need second argument 'post'?
I read the explanation:
If the route has a dynamic segment, a model that represents the segment. By default, Ember.js will replace the segment with the value of the object's id property.
but I can't associate this explanation with question above.
The #linkTo
helper takes three parameters.
posts.post
post
object you are referring to in the looptitle
is supported)Because the posts.post
route is a dynamic route, e.g. it can be for one of a collection of posts, we must provide the #linkTo
helper with which particular post you are wanting to link to.