I have been using Typeahead 0.9.3 with Hogan 2 for a while and it was very straight forward to setup.
in 0.9.3 I did something like:
$(\'input.search
As stated by Jake Harding, the solution for modern browsers is like so:
var compiledTemplate = Hogan.compile('{{value}}');
$('input.search-query').typeahead(null, {
// ...
templates: {
suggestion: compiledTemplate.render.bind(compiledTemplate);
}
});
Unfortunately, Function.prototype.bind() is not supported by IE < 9, so if you need to support older browsers that will not work.
The good news is that as stated by Steve Pavarno you don't need a template engine anymore. You can achieve the desired result by passing a function like so:
// ...
templates: {
suggestion: function(data) { // data is an object as returned by suggestion engine
return '' + data.value + '';
};
}