How to use jQuery autocomplete in angular 2 rc4

孤人 提交于 2019-12-24 07:19:46

问题


I am trying to use jQuery autocomplete in angular 2 rc4 version but i am getting error as 'property autocomplete does not exist on type jquery'

My HTML is :

<input class="search" id="search-input" type="text" placeholder="Search"/>

& my app.component.ts is

heroes:any = [100,200,101];
ngOnInit(): void { 
  jQuery( "#search-input" ).autocomplete({
    source: this.heroes
  });
}

expected result should be when i enter 1 in input box then 100 and 101 should pop up and i can move along result using arrow keys.

I already installed JQuery typings as my other jQuery functionsworks well and i also tried to use solution from https://www.npmjs.com/package/ang2-autocomplete, but i think its for another versions of angular rc.

Thanks in advance.

来源:https://stackoverflow.com/questions/41396142/how-to-use-jquery-autocomplete-in-angular-2-rc4

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!