How do you create a Handlebars helper that is aware of Ember bindings?

When I try to pass an Ember binding or computed property to the Handlebars special helper, the helper gets a string instead of a value. How to get value in helper?

Template:

{{my_helper my.binding}}

The helper gets "my.binding" instead of the corresponding value.

+5
source share
2 answers

A few days ago, clicking on the wizard resolved the problem: use Ember.Handlebars.registerBoundHelper.

Ember.Handlebars.registerBoundHelper('myHelper', 
    function(myBinding, options) {
        return myDealWith(myBinding);
    }
);
+6
source

You must use Ember.getPath to get the value in the helper method.
See Documents http://emberjs.com/documentation/#toc_writing-custom-helpers

+4

All Articles