2016-08-10 2 views
0

TypeScript 모듈 내에서 TypeAhead 라이브러리를 호출하려고합니다. 어떻게 후속 스크립트와 유사한 스크립트를 만들 수 있습니까?TypeScript에서 TypeAhead 메서드 호출

const datasource = new Bloodhound({ 
    datumTokenizer: Bloodhound.tokenizers.whitespace, 
    queryTokenizer: Bloodhound.tokenizers.whitespace, 
    remote: { 
     url: "MyUrl%QUERY", 
     wildcard: "%QUERY" 
    } 
}); 

const inputOptions = { 
    hint: true, 
    highlight: true, 
    minLength: 0 
}; 

const apiSettings = { 
    name: "DisplayName", 
    display: "Name", 
    source: datasource, 
    limit: 20, 
    templates: { 
     empty: "", 
     suggestion(data: any) { 
      return ""; 
     } 
    } 
}; 

$ReferrerSearchInput.typeahead(inputOptions, apiSettings); 
:
/// <reference path="typings/jquery/jquery.d.ts" /> 
/// <reference path="typings/typeahead/typeahead.d.ts" /> 

$ReferrerSearchInput.typeahead({ 
    hint: false, 
    highlight: false, 
    minLength: 3 
}, 
{ 
    name: "Referrers", 
    display: "DisplayValue", 
    source: referrersDatasource, 
    limit: 20, 
    templates: { 
     suggestion: function(data) { 
      return data.FullName; 
     } 
    } 
}); 

답변

1

내가 그것을 해결하는 방법입니다