Handlebars passing object into helper

主宰稳场 提交于 2019-12-04 08:20:47

There's a difference between Handlebars & Ember.Handlebars, Ember extends Handlebars internally to add extra functionality.

That being said you are using the wrong helper here, you need to use Ember.Handlebars.registerBoundHelper.

Ember.Handlebars.registerBoundHelper('hasHitTarget', function(attribute) {
  if (attribute.actual >= attribute.target) {
    return block(this);
  }
});
stukennedy

Passing an object to a Handlebars Helper from within an #each doesn't work as intended, due to a bug in Ember (currently v1.0), there is a workaround though ... see my post here

https://stackoverflow.com/a/18787740/1780102

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!