Reputation: 897
The href
attribute scope binding is not working in Ember.js
. I wanted it to be binded as /fruits/1
. PFB the code.
home.hbs
<ul>
{{#each fruits as |fruit|}}
{{list-item href="/fruits/{{fruit.id}}" item=fruit onitemclick=(action "handleFruitsDetail")}}
{{else}}
<li>Loading!</li>
{{/each}}
</ul>
list-item
is a custom component where I am passing and binding href
's. PFB the code for it.
list-item.hbs
<li>
<a href="{{href}}" onclick={{action "handleItemClick"}}>{{item.name}}</a>
</li>
Thanks in advance.
Upvotes: 0
Views: 164
Reputation: 18240
href="/fruits/{{fruit.id}}"
is not a valid syntax to give attributes to ember components. The correct syntax is:
{{list-item href=(concat "/fruits/" fruit.id) item=fruit onitemclick=(action "handleFruitsDetail")}}
Upvotes: 1