Ember / Handlebars: How to write the attribute str

2019-09-06 01:17发布

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

2条回答
兄弟一词,经得起流年.
2楼-- · 2019-09-06 02:16

For Ember newcomers (whom came to this question by Googleling for example), since Ember 1.11 and later, you should write:

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

Just as OP wrote in his question!


Note: Since Ember 1.13 the bind-attr helper has been deprecated.

查看更多
Emotional °昔
3楼-- · 2019-09-06 02:23

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.

查看更多
登录 后发表回答