得到帮助不适合attrs hash

时间:2015-10-28 10:49:23

标签: ember.js htmlbars

{{my-component can-delete=true canDelete=true}}

my-component模板中,我想从can-delete对象访问attrs

{{attrs.can-delete}} <!-- does not work, prints blank, should print true -->
{{attrs.canDelete}} <!-- works, prints true-->

我尝试使用get helper

{{get attrs 'can-delete'}}

但收到错误Uncaught Error: Assertion Failed: The first argument to {{get}} must be a stream

如何从不常用格式的HTMLBars中访问对象属性?

1 个答案:

答案 0 :(得分:0)

即使没有&#39; get&#39;这里的涓涓细流似乎也很好。帮手:http://ember-twiddle.com/f101eb114ea0b8ad3e92