Reactgular
Reactgular

Reputation: 54781

What does "ng add" do in Angular CLI 6.0.8

There doesn't appear to be any documentation for the ng add <collection> command for Angular 6. This appears to be a new feature, but I don't know what it does.

It's not listed on the official Wiki page:

https://github.com/angular/angular-cli/wiki

There is a child Wiki page for the command:

https://github.com/angular/angular-cli/wiki/add

But it says the same thing as the command line help.

Add support for a library to your project.

What library are they referring to? Is it a library like https://material.angular.io/ or is it something else?

Upvotes: 20

Views: 9931

Answers (1)

baao
baao

Reputation: 73241

There's a good article available in the blog that explains this new feature

Another new CLI command ng add makes adding new capabilities to your project easy. ng add will use your package manager to download new dependencies and invoke an installation script (implemented as a schematic) which can update your project with configuration changes, add additional dependencies (e.g. polyfills), or scaffold package-specific initialization code.

Because ng add is built on top of schematics and the npm registry, our hope is that libraries and the community will help us build a rich ecosystem of ng add supporting packages.

Take a look at Angular Material’s ng-add schematic for an example to help you get started building your own ng-add schematics.

For example, the command can automatically update your app.module.ts and more to enable you to use the lib directly, without further hastle

Upvotes: 21

Related Questions