Linked Face Block Helper

I am wondering if registerBoundHelper in ember should ever be able to handle block style helpers. For example, I created the following:

Ember.Handlebars.registerBoundHelper('unlessUndefined', (context, options) -> unless typeof context == "undefined" return options.fn(this) else return options.inverse(this) ) 

The idea is to use it as such:

 {{#unlessUndefined choice}} {{#if choice}} <p>You chose yes</p> {{else}} <p>You chose no</p> {{/if}} {{else}} <p>Make a choice</p> {{/unlessUndefined}} 

The options.fn (this) elements do not display any output. In doing so, I get an error in the console that says: "You cannot use appendChild outside the rendering process"

If this is not possible, maybe someone can suggest another way to get a conditional block that will only show if the border value is not undefined?

+7
source share
1 answer

I just spent a lot of time fighting this and found a fix. I looked at the pull request with the implementation of the registerBoundHelper method.

I added the following line: https://github.com/emberjs/ember.js/pull/1274/files#L0R357

 Ember.run.scheduleOnce('render', view, 'rerender') 

The boundHelper method seems to just wrap the original helper method and create an anonymous view. The only problem is that the observer puts the anonymous view in rendering mode, without putting the original view in the same first one.

At least I think this is happening. Anyway, now it works for me. Maybe this is a mistake?

+4
source

All Articles