user2280016
user2280016

Reputation: 1850

Property 'slider' does not exist on type 'JQuery' with typescript

how to come out of this error?

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

Error:

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

Upvotes: 1

Views: 4929

Answers (3)

hd1coder
hd1coder

Reputation: 21

Adding jqueryui types to your project may resolve this issue. It did for me, I was using $(".abc").tabs(), and would receive a similar error. Adding the types via npm command below resolved. Note that you execute this command in your project root using cmd/terminal

npm i -D @types/jqueryui

Upvotes: 0

Rolland Saf
Rolland Saf

Reputation: 91

Try adding this at the top of the component

declare let jQuery: any;

Upvotes: 1

Paul Roefs
Paul Roefs

Reputation: 468

you should use the jQueryUI, you can get it at http://jqueryui.com/download/

jQuery itself doesn't have the slider property

Upvotes: 0

Related Questions