Skip to content

Instantly share code, notes, and snippets.

@Koc
Created September 11, 2014 15:42
Show Gist options
  • Save Koc/ccc0112d4c28b19720c2 to your computer and use it in GitHub Desktop.
Save Koc/ccc0112d4c28b19720c2 to your computer and use it in GitHub Desktop.
Typeahead prefetch filtering example
$el.typeahead({
minLength: 2,
autoselect: true,
hint: false,
highlight: true
}, {
source: function(query, cb) {
suggestSource.ttAdapter()(query, function(items) {
var filteredItems = [];
angular.forEach(items, function(item) {
//TODO: add filter check here
filteredItems.push(item);
});
cb(filteredItems);
});
},
displayKey: 'title',
templates: {
empty: '<div class="empty-message">Результаты не найдены</div>'
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment