【发布时间】:2015-08-03 08:10:44
【问题描述】:
我正在关注this example for typeahead.js 使用Bloodhound 到T,但我收到了一个javascript 错误。我错过了什么?
HTML:(.net 剃须刀视图)
@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
});
});
在typeahead.bundle.js 中给出错误:
this.source 不是函数
【问题讨论】:
标签: javascript typeahead.js bloodhound