2016-11-20 66 views
1

我在Angular2中使用外部JavaScript庫。當我啓動服務器時,我在終端中收到錯誤。Angular2找不到名字'UISearch'

找不到名字'UISearch'。 [默認]檢查已完成了1個錯誤

我的代碼

ngAfterViewInit() { 
    new UISearch(document.getElementById('sb-search')); 
} 

UISearch具有紅色曲線誤差線。 我認爲,我需要追加'<任何>',但我不知道如何。我希望你能幫助我

+1

你如何導入JavaScript庫到您的Angular2應用程序? – Michael

+0

我安裝了jquery'tsd install jquery --save'和'/// ''我導入了這樣的UIsearch庫。 Index.html:''。 Uisearch正常工作,但我有一個錯誤終端 –

回答

0

你是如何導入UISearch的?如果庫是進口的,你可能會想嘗試:

constructor(private UISearch:uisearch){} 

ngAfterViewInit() { 
this.uisearch(document.getElementById('sb-search')); 

}

+0

我安裝了jquery'tsd install jquery --save'和'/// ''我這樣導入了UIsearch庫。 Index.html:''。 Uisearch正常工作,但我在終端有錯誤 –