How to Install and Use jQuery with Angular 9?


Angular 9 is one of the most popular modern frameworks for building JavaScript user interfaces based on TypeScript whereas jQuery is the legacy library for manipulating the DOM. It’s not very recommended to use jQuery with Angular but in many cases, we may need to use them both so how you can install and use jQuery in your Angular 9 project? 

February 27, 2020

Step 1 – Install jQuery via NPM

We need to start by installing the jquery library via npm:

Step 2 – Tell Angular About jQuery

Open the angular.json file and the library to scripts array as follows:

Step 3 – Calling jQuery Methods

You can then use jquery methods in your components.

Open the src/app/app.component.ts file and update it as follows:

Skip to toolbar