2017-02-21 67 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; 
相關問題