I'm following this example for typeahead.js
using Bloodhound
to the T, but I'm getting a javascript error. What am I missing?
HTML: (.net razor view)
@Scripts.Render(Links.Scripts.typeahead_bundle_js)
@Styles.Render(Links.Content.typeahead_min_css)
<input id="myInput" type="text" class="form-control" />
JS:
$(function () {
var data = ["abce", "abcd", 'def', 'abcdef'];
var bh = new Bloodhound({
local: data,
queryTokenizer: Bloodhound.tokenizers.whitespace,
datumTokenizer: Bloodhound.tokenizers.whitespace
});
//bh.initialize(); //this wasn't in the example, adding it had no effect
$('#myInput').typeahead({
highlight:true
},
{
name: "testData",
source: bh
});
});
gives the error in typeahead.bundle.js
:
this.source is not a function