Overview ๐Ÿ“„

The Angular CLI recently introduced a new command in version 6.0.0, ng add. At a glance, it looks like an alternative to npm install but let us take a look and see how the two approaches differ.

Deeper look at ng add ๐Ÿ‘๏ธโ€๐Ÿ—จ๏ธ

In short, ng add will use your package manager to download the specified dependency, just as you would using npm install. Once downloaded the CLI will call an installation script which usually contains instructions on how to configure the project with the new dependency. These instructions will be carried out automatically by the CLI preventing users having to configure and add additional dependencies that could be required.

Give it a go now by starting a new project and use the Angular CLI to add Angular Material, see below.

ng add @angular/material


Gif demoing ng add