Helper broken in Ember 1.10

前端 未结 1 1391
醉话见心
醉话见心 2021-01-14 07:23

I was using custom Handlebars helper extending the functionality of \'if\' block.

In Ember 1.10 this doesnt work anymore as there is no Ember.Handlebars.bind propert

相关标签:
1条回答
  • 2021-01-14 07:47

    I actually managed to find a way to do it, so I'll write the answer for my own question...

    Instead of using undocumented hacks, I used the proposed change: https://github.com/emberjs/ember.js/issues/10295

    So my helper looks like this now:

    Ember.Handlebars.registerBoundHelper('isSame', function(value1, value2) {
        return value1 === value2
    });
    

    and the usage:

    {{#if (isSame property "value")}}
        {{some-other-component}}
    {{else if (isSame property "otherValue"}}
        something other...
    {{else}}
        something other...
    {{/if}}
    
    0 讨论(0)
提交回复
热议问题