Ember / Handlebars:如何编写属性字符串 [英] Ember / Handlebars: How to write the attribute string

查看:114
本文介绍了Ember / Handlebars:如何编写属性字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如:

 < img src ={{profile.avatar}}/> 

我真的必须为此创建一个帮助器吗?还是可以写属性字符串您可以使用 bind-attr -helper来解决这个问题。 bindAttr 也可以使用,但自从 rel =nofollow> 1.0 RC8 ,正如直观像素指出的那样。

 < img {{bind -attr src = profile.avatar}} /> 

更多信息请见 guide


For example:

<img src="{{profile.avatar}}"/>

Do I really have to create a helper for this or is it possible to write the attribute string

解决方案

You use the bind-attr-helper for this. bindAttr will also work but is deprecated since 1.0 RC8 as pointed out by intuitivepixel.

<img {{bind-attr src=profile.avatar}}/>

More info is available in their guide.

这篇关于Ember / Handlebars:如何编写属性字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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