2017-05-29 9 views
1

typeahead.jsを使用してAngular2アプリでtypeaheadを実装しようとしています。 typescriptファイルで、次のインポートセグメントを追加しました。javascript:指定されたパラメータが呼び出し対象のシグネチャと一致しません

import initTypeahead = require("../../../assets/js/init/dashboard.js"); 

dashboard.d.ts

declare function initTypeahead(data:any,id:any): void; 
export = initTypeahead(data,id); 

dashboard.jsそしてtypescriptですに次の行が追加され

if ('undefined' !== typeof module) { 

    module.exports = function initTypeahead(data, element) { 
    console.log(data); 
    console.log(element); 
    var _values = new Bloodhound({ 
     datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'), 
     queryTokenizer: Bloodhound.tokenizers.whitespace, 
     local: data 
    }); 
    _values.initialize(); 

    var elt = $(element); 
    elt.tagsinput({ 
     itemValue: 'code', 
     itemText: 'value', 
     typeaheadjs: { 
     name: '_values', 
     displayKey: 'value', 
     source: _values.ttAdapter() 
     } 
    }); 
    } 
} 

private getCities(): void { 
    this.componentsService.getCriteriaValues(this.product, "city").subscribe(res => { 
    initTypeahead(res.returnData, '#city'); // error at this line 

    }); 


} 

次のエラーが

Supplied parameters do not match any signature of call target. 

任意の提案が高く評価されているサービスを提供NG 上に表示されます。

+0

Angular-cliを使用していますか? – SrAxi

+0

@SrAxi、はい私はangle-cliを使用しています – Rose18

答えて

関連する問題