Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
例如:
<img src="{{profile.avatar}}"/>
我真的需要为此创建一个助手还是可以编写属性字符串
您bind-attr为此使用 -helper。bindAttr也可以工作,但自1.0 RC8以来已被弃用,正如直观像素所指出的那样。
bind-attr
bindAttr
<img {{bind-attr src=profile.avatar}}/>
更多信息可在他们的指南中找到。
对于 Ember 新手(例如,他们通过 Googleling 提出了这个问题),从 Ember 1.11 及更高版本开始,您应该编写:
正如OP在他的问题中所写!
注意:自 Ember 1.13 起,bind-attr助手已被弃用。