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?
ng add <collection> [options] Description. Adds the npm package for a published library to your workspace, and configures your default app project to use that library, in whatever way is specified by the library's schematic. For example, adding @angular/pwa configures your project for PWA support: ng add @angular/pwa.
Whereas npm install <package> will only install your package into your project but will not configure in order to use. So, you mean a command like, ng add <package > will configure the package in angular-cli. json as well. Thank you so much for nice examples.
ng new also creates the following workspace and starter project files: A new workspace, with a root directory named angular-tour-of-heroes. An initial skeleton application project in the src/app subdirectory. Related configuration files.
ng new command creates a workspace of given name with a default Angular Application. It provides interactive prompts to set optional configurations. All prompts have default values to choose.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With