2017-02-21 65 views
1

如何摆脱这种错误?属性“滑块”不存在类型'JQuery'与打字稿

jQuery(this.el.nativeElement.children[0]).slider('option', optionName, this.value); 

错误:

file: 'file:/slider_component/slider.component.ts' 
severity: 'Error' 
message: 'Property 'slider' does not exist on type 'JQuery'.' 
at: '85,55' 
source: 'ts' 
+2

滑块不是JqueryUI的一部分吗?也许检查https://jqueryui.com/slider/你可能没有包含JqueryUI或错误的顺序。 如果您创建一个片段或向我们显示您的代码,这将有所帮助 –

+0

如何使用打字稿进行安装? – user2280016

+0

看看这里http://stackoverflow.com/questions/13980549/best-way-to-make-jquery-ui-with-typescript –

回答

0

你应该使用jQueryUI的,你可以在http://jqueryui.com/download/

jQuery的得到它本身不具有滑块财产

+0

我已经添加了这个,但vs代码显示错误 – user2280016

+0

@ user2280016你能告诉我一点点代码? –

+0

我已经在index.html中添加了,你想要什么代码 – user2280016

1

尝试添加该位于组件的顶部

declare let jQuery: any; 
相关问题