The Angular CLI is a command line interface tool that allows us to quickly build and run our Angular applications. The CLI can help us quickly scaffold components and services in our app while following the best practices out of the box.
Step 1: NPM
First we need to install Lodash from npm.
npm install lodash --save
Now that we have installed Lodash we need to install the TypeScript type definitions to allow our code to have better auto-competion and development experience. If you use a library that was written in TypeScript such as RxJS you don’t have to worry about installing the type definitions.
npm install @types/lodash --save
Now that lodash is installed we can import it into any file in our app.
import * as _ from 'lodash';
Sometimes we need to load global scripts or CSS files into our projects that are not module based. The Angular CLI has a configuration option to load files such as these. In the
angular-cli.json you can find a
scripts option where you can add the file paths of any files you would like globally bundled with you application. Note these files are bundled first before the rest of our module bundle.
"styles": [ "styles.css" ], "scripts":