1
votes

I'm working on upgrading my grunt CLI based ember 1.8 app to 1.10 with HTMLbars & have made progress, but my view helpers and components don't work; such as date-input, ember-select, bing-map, product-item. So I'm starting with the date-input view helper which returns this error now - "Ember.Handlebars.helpers.view.call is not a function". This input control is rendered via {{date-input... which is associated to 'DateInputView' in views/date-input.js which extends Ember.TextField. It's also associated to helpers/date-input.js and Ember.Handlebars.makeBoundHelper(). The function inside returns Ember.Handlebars.helpers.view.call() which results in the error. I read something about how maybe my template compiler isn't the new one required or maybe a Component should be used rather than a View Helper, but it seems like there should be a simple fix for the View Helper, don't you think?

1
Instead of explaining everything, paste a code snippet.givanse
Check that you are using the correct version of ember-template-compiler in your build pipeline. See emberjs.com/blog/2015/02/05/compiling-templates-in-1-10-0.htmlGaurav
My node modules still had "ember-template-compiler": "1.8.0" so I uninstalled it and now grunt-ember-templates ember_templates.js can't find the module. It appears that grunt-ember-templates is upgraded now for HTMLbars and that this is the version pulled into my project. The emberjs doc states the main difference in compilation is the path to the module, so I changed it to use the version paired with ember (compiler = require(../../../vendor/ember/ember-template-compiler)). Now the grunt build will run but I get the same result - Ember.Handlebars.helpers.view.call is not a function.bobvan
Also I had been getting "Please load ember-template-compiler.js prior to calling compile" so I added the ember compiler into the 'index.html' head as a workaround. I removed that now thinking I had correctly pre-compiled templates, but then this error came back. I guess the overlying question is if I take an ember 1.6 - 1.8 project built with gruntfile tasks, what modules and packages do I need to change so it will build and run on ember 1.10? It seems like some dependencies just aren't lining up.bobvan
Changing the path to the compiler made no difference & my DOM lacks metamorph tags so seems I had the right compiler. Having the compiler in the index.html is normal for development. I can change to Ember.HTMLBars.makeBoundHelper, passing in 4 args rather than 1, but the result is still the same. It seems that 'call' has been removed from Handlebars.helpers.view, so need to find some upgraded syntax or approach for things like - return Ember.Handlebars.helpers.view.call(this, DateInputView, options)bobvan

1 Answers

0
votes

Development of this viewHelper was done by another party and the purpose of the callback making a call to viewHelper is a mystery. Regardless, the use of viewHelpers is being discouraged going forward and I've re-worked the date-input as a Component.