Reputation: 1794
I am setting up typeahead like so:
$this.typeahead({
prefetch: $this.data('url-prefetch'),
templates: {
empty: 'No matching files found'
}
})
The prefetch is working fine but the empty template is not displayed when there are no matches.
Upvotes: 3
Views: 3153
Reputation: 2245
To whoever comes across this issue:
"Empty" template will not show up if you have {async:true} in the options
$this.typeahead({
async: false,
prefetch: $this.data('url-prefetch'),
templates: {
empty: 'No matching files found'
}
});
Upvotes: 2
Reputation: 15298
Fundamental changes have been made in Typeahead.js v0.10.x. Examining your code, it looks like you're targeting Typeahead v0.9.x, so make sure you load this older version, or things won't work.
I suggest you update your code to support v0.10.x, here is a migration guide: https://github.com/twitter/typeahead.js/blob/master/doc/migration/0.10.0.md
Upvotes: 1