ember.js-viewhtmlbars

Are bound viewHelpers in ember 1.10 still supported by the framework?


In a non-CLI ember app, I have a viewHelper which used to work on an Ember.TextField using Handlebars.makeBoundHelper to change the input type to 'date' for mobile devices. Now with ember 1.10/HTMLBars I get an 'options.helperName is undefined' error. I try changing to 'HTMLBars.makeBoundHelper', and I see more properties within the method, but they're different from before. There was also an error about 'Handlebars.helpers.view.call' undefined, so I changed to 'Handlebars.helpers.view.helperFunction.call'. It appears that the function passed into makeBoundHelper is used as a callback, and the return at the end, a call to viewHelper(), serves to register it. But the call to viewHelper is a problem. With Handlebars.makeBoundHelper, I get the options.helperName error, even if I set it on the 'options' myself. With HTMLBars.makeBoundHelper, I get an error about viewHelper only accepts 1 param. I only reference one param in the callback, though the framework is actually passing in 4. Changing the number of args passed into the 'return helperFunction.call' doesn't make a difference.


Solution

  • I posted an issue on this at emberjs github, regarding how no approach or variation on syntax works. It appears that the API for viewHelper in HTMLBars is in complete, doesn't work and is not ready for prime time. Regardless, I dropped the date-input View and viewHelper and implemented a Component which I hope can & will accomplish the same functionality. So far it works in that it renders an input with a datepicker attached, and also renders the version for mobile devices. The only question remaining is if if will bind to the property in the Controller like the original version did.