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-query').typeahead([
{
name: "pages"
,local: localSuggestions
,template: '<div class="tt-suggest-page">{{value}}</div>'
,engine: Hogan
}
]);
According to the Migration Guide to 0.10 "Precompiled Templates are Now Required", so in 0.10.3 I'm trying:
$('input.search-query').typeahead(null, {
name: "pages"
,source: taSourceLocal.ttAdapter()
,templates: {
suggestion: Hogan.compile('<div class="tt-suggest-page">{{value}}</div>')
}
});
but it does not work. I get an error: Uncaught TypeError: object is not a function
If there is another, minimalist template engine that can work I will consider it as well, but it has to be small. I don't want to add a huge file like Handlebars or a whole library like Underscore.
any ideas? TIA!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…