定制绑定在xhandlebars脚本的灰烬查看属性与控制器数据 [英] Bind custom attributes on Ember view with controller data in xhandlebars script

查看:121
本文介绍了定制绑定在xhandlebars脚本的灰烬查看属性与控制器数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

{{#each App.SampleViewController}}
     {{#view App.SampleView contentBinding="this" sort-date="content.sortDate" name="content.name"}}
            <a href="#" onclick="App.loadSampleDetails(this);" {{bindAttr id="content.id"}}>
         {{/view}}
    {{/each}}

如何添加自定义属性/通用的属性(如上面的例子排序日期/ name属性)从xhandlebars script标签的视图元素,我都知道,使用attributeBindings我们可以添加,但我有动态数据来从控制器通过每个

How to add custom attributes/generic attributes (like in the above example sort-date/name attributes) to the view element from the xhandlebars script tag, I know that using attributeBindings we can add, but I have the dynamic data coming from controller through each.

推荐答案

您可以使用 attributeBindings 属性来定义将被添加到DOM输出的附加属性视图。参见HTML属性,在Ember.View文档部分:的http:// docs.emberjs.com/#doc=Ember.View&src=false

You can use the attributeBindings property to define additional attributes that will get added to the DOM output for a view. See the "HTML Attributes" section in the Ember.View docs: http://docs.emberjs.com/#doc=Ember.View&src=false

这篇关于定制绑定在xhandlebars脚本的灰烬查看属性与控制器数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆