Saturday, April 6, 2019

How to use jQuery with Angular?

The quick way to use jQuery in Angular is very easy. Just follow the steps below.

1. First install Jquery in your angular project using following command

npm i --save jquery

2. Then go to angular.json file and find the script part.

3. Just call the js file from the installed folder

4. The js file path is like  "node_modules/jquery/dist/jquery.min.js"

            "styles": [
              "src/styles.css"
            ],
            "scripts": [
              "node_modules/jquery/dist/jquery.min.js"
            ]

5. Now we came to the final step, just check jquery is working or not using some script.

6. Go to your component file and import jquery (import * as $ from 'jquery';) then add alert function in your component.ts file.


For Example -:) alert("Helo Siva.....!") 

No comments:

Post a Comment