Add jQuery to Angular (4) project

This week-end I struggled to add jQuery to my angular project.

After a long battle, I finally won (victory was to change the color of a title, wow.)

So, what to do to include jquery to an Angular (testing on version 4) project ?

First, add jQuery dependency :

npm install jquery --save

Install typings :

npm instal @types/jquery --save-dev

Add typings :

typings install dt~jquery --save --global

In you .angular-cli.json, include jquery to scripts :


And finally, include it in you component :

import * as jquery from 'jquery';

You can then use it :

jquery(#tilte).css('color', 'black');

(of for something more interesting…).

Hope it will help someone !