Javascript 绑定属性的Ember js pass id

Javascript 绑定属性的Ember js pass id,javascript,ember.js,Javascript,Ember.js,是否可以将动态id传递给绑定属性 我有以下模板- {{#each attachments}} <a {{bind-attr href = attachmentDownloadUrl }} download title='download attachment'> <span class='glyphicon glyphicon-floppy-save'> </span> </a> {{/each}} 如何传递身份证?谢谢您不会将

是否可以将动态id传递给绑定属性

我有以下模板-

{{#each attachments}}
  <a {{bind-attr href = attachmentDownloadUrl }} download title='download attachment'>
   <span class='glyphicon glyphicon-floppy-save'> </span>

 </a>


{{/each}}

如何传递身份证?谢谢

您不会将参数传递给computed属性,但是您可以创建一个
itemController
,它可以使计算属性特定于每个项,而不是集合

模板
引用自:除了普通文本外,您可能还希望模板包含属性绑定到控制器的HTML元素。我使用Handlebar helper传递id,然后从helper中返回动态标记。想知道哪个是更好的练习,助手还是物品管理员?
attachmentDownloadUrl: function(id){
        console.log(id);
        return "xxx"+id;
    }.property('id'),
{{#each item in attachments itemController='foo'}}
  <a {{bind-attr href=item.attachmentDownloadUrl }} download title='download attachment'>
   <span class='glyphicon glyphicon-floppy-save'> </span>
 </a>
{{/each}}
App.FooController = Em.ObjectController.extend({
  attachmentDownloadUrl: function(){
    return "xxx"+this.get('id');
  }.property('id')
});