pooky
pooky

Reputation: 31

how to integrate jquery files with angular 4

i am new to angular 4. i am calling a jquery function with html tag from a method. And that jquery method is defined in another file. so how to write those in angular? this is the example

sample() {
  $.("represent-visualization").Sample();
}

And the function Sample is defined in a jquery file

(function( $ ){
   $.fn.sample()
    {
     }
 })(jquery);

Upvotes: 3

Views: 62

Answers (1)

Manoj Meria
Manoj Meria

Reputation: 606

npm install jquery --save


npm install --save-dev @types/jquery

Install jquery with npm

npm install jquery --save

Add typings

npm install --save-dev @types/jquery

Add scripts to angular-cli.json

when you cant to import

import * as jquery from "jquery";

jquery.("represent-visualization").Sample();

Upvotes: 1

Related Questions