我正在尝试将Bootstrap Tags Input v.0.5.0 与typeahead.js v.0.11.1 和 Bootstrap v3.3.5 一起使用。它对我有用,但我无法输入我的 typeahead 源数组中不存在的标签。为了允许输入源数组中不存在的项目,我需要更改什么?
这是我的示例 html:
<input type="text" id="dailyTagsInput" name="dailyTagsInput" class="form-control">
这是我的示例js:
$scope.states = ['Alabama', 'Alaska', 'Arizona'];
$scope.statesSource = new Bloodhound({
datumTokenizer: Bloodhound.tokenizers.whitespace,
queryTokenizer: Bloodhound.tokenizers.whitespace,
local: $scope.states
});
$('#dailyTagsInput').tagsinput({
maxChars: 50,
maxTags: 10,
trimValue: true,
freeInput: true,
typeaheadjs: {
name: 'states',
source: $scope.statesSource.ttAdapter()
}
});