3 Steps:
Install jQuery. (skip if already installed)
npm install jquery –save
Install types for jQuery.
npm install @types/jquery –save
Import jQuery in app.module.ts.
import * as $ from ‘jquery’;
The best way to enable the production mode for an Angular 2 application, is to use angular-cli and build the application with
ng build -prod
. This will build the application with production profile. Using angular-cli has the benefit of being able to use development mode using ng serve
or ng build
while developing without altering the code all the time.