0
私は、角度cliプロジェクトで@ types/typeaheadを使用しようとしています。次のコマンドを使用してtypehead.js型定義をインストールしました。Angular 4 cliプロジェクトで@ types/typeaheadを使用する
npm install --save @types/typeahead
コンポーネントのOnInit()メソッドで以下を実行しました。
const suggestions = [{
value: 'string1'
}, {
value: 'string2'
}, {
value: 'string3'
}, {
value: 'string4'
}, {
value: 'string5'
}];
let bloodhoundSuggestions = new Bloodhound({
datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'),
queryTokenizer: Bloodhound.tokenizers.whitespace,
sufficient: 3,
local: this.suggestions
});
ただし、常に次のエラーが発生します。
Can not find name 'Bloodhound'
次のファイルをangular-cli.jsonファイルにも追加しました。
"assets/js/bloodhound.min.js",
"assets/js/typeahead.bundle.min.js"
jQueryもインストールされています。