I\'m trying to use the code below with typeahead.js v 0.10
// instantiate the bloodhound suggestion engine
var numbers = new Bloodhound({
datumTokenizer: fun
I implemented Bloodhound.get() as follows (also see this fiddle : http://jsfiddle.net/Fresh/HS9Wy/):
// instantiate the bloodhound suggestion engine
var numbers = new Bloodhound({
datumTokenizer: function (d) {
return d;
},
queryTokenizer: Bloodhound.tokenizers.whitespace,
local: ["(A)labama", "Alaska", "Arizona", "Arkansas"]
});
// initialize the bloodhound suggestion engine
numbers.initialize();
// Get an array of datums which satisfy the query for 'a'
numbers.get('a', function (suggestions) {
jQuery.each(suggestions, function (index, item) {
console.log(item);
});
});
The problem with your call to "get()" i.e.
numbers.get('a')
Is that whilst you are getting Bloodhound to execute the query for 'a' you are not doing anything with the results. To instruct "get()" to do something useful you need to send the results to the output function. See the documentation here.