ng add <collection>
似乎没有任何文档Angular 6 的命令。这似乎是一项新功能,但我不知道它的作用。
它没有在官方 Wiki 页面上列出:
https://github.com/angular/angular-cli/wiki
命令有一个子 Wiki 页面:
https://github.com/angular/angular-cli/wiki/add
但是它说的和命令行帮助是一样的。
Add support for a library to your project.
他们指的是什么图书馆?是像https://material.angular.io/这样的图书馆吗?或者是别的什么?
最佳答案
blog 中有一篇很好的文章解释了这个新功能
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.
例如,该命令可以自动更新您的 app.module.ts
等,使您能够直接使用该库,而无需进一步的麻烦
关于angular - "ng add"在 Angular CLI 6.0.8 中做什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51109959/