javascript - Typeahead.js with Ember's HTMLBars -


we've been using typeahead.js library in our ember app (via this addon) success on ember versions prior 1.10, upgrade ember 1.10 causing problems.

until we've had success compiling templates passed typeahead component , passing along typeahead library this:

templates: {   // this.get('suggestiontemplate') string of handlebars template   suggestion: handlebars.compile(this.get('suggestiontemplate')),   <other code> } 

this not work in ember 1.10, however, typeahead.js throws below error when executing line of code:

code:

$el = $(html.suggestion).append(that.templates.suggestion(suggestion)).data(datasetkey, that.name).data(valuekey, that.displayfn(suggestion)).data(datumkey, suggestion); 

error:

uncaught typeerror: that.templates.suggestion not function

previously that.templates.suggestion, value first code block above, function passed object suggestion , compile actual template. htmlbars, that.templates.suggestion no longer function rather htmlbars object, code no longer works.

is there better way same thing in ember 1.10 match previous behavior?

i remember had similar problem using handlebars.compile ended opting passing function suggestion instead, , template content:

templates: {   empty: '<span>no results</span>',   suggestion: function(item){    return '<div>' + item.name + '</div>';   } } 

hope works too.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -