DZN
DZN

Reputation: 1553

How to install jQuery typings (for using its functions in an Angular 2 component)?

I need to use some jQuery plugins in Angular 2 project, so I need to call jQuery functions in my A2 components.

I found advice to install ts typings for jQuery and then declare jQuery in an A2 component: declare var $:JQueryStatic;

I tried to install typings this way: tsd install jquery --save but got zero results message...

What am I doing wrong?

Upvotes: 1

Views: 1094

Answers (1)

Technohacker
Technohacker

Reputation: 735

If you are using Typescript >=2.x.x, typings are now installed from NPM. For example, the typings package for jQuery is @types/jquery for jQuery 1.10.x.

Install using the following:

npm install --save-dev @types/jquery

Upvotes: 4

Related Questions