2016-11-20 61 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正常工作,但我在终端有错误 –