ng add
为你的项目添加对外部库的支持
Adds support for an external library to your project.
      
      ng add <collection> [options]
    说明
把一个已发布库的 npm 包添加到你的工作空间中,并且在当前工作目录下按照该库的原理图对项目进行配置,以使用该库。(如果没有在项目目录下,则为默认项目)。 比如添加 @angular/pwa 会把你的项目配置为支持 PWA 的:
Adds the npm package for a published library to your workspace, and configures the project in the current working directory (or the default project if you are not in a project directory) to use that library, as specified by the library's schematic. For example, adding @angular/pwa configures your project for PWA support:
      
      ng add @angular/pwa
    默认项目就是指 angular.json 中的 defaultProject 所指定的。
The default project is the value of defaultProject in angular.json.
参数
| 参数 | 说明 | Value Type | 
|---|---|---|
| <collection> | 要添加的包。 The package to be added. | string | 
选项
| 选项 | 说明 | Value Type | Default Value | 
|---|---|---|---|
| --defaults | 对有默认值的选项禁用交互式输入提示。 Disable interactive input prompts for options with a default. | boolean | |
| --help | 在控制台显示关于本命令的帮助信息。 Shows a help message for this command in the console. | true|false|json|JSON | false | 
| --interactive | 启用交互式输入提示。 Enable interactive input prompts. | boolean | |
| --registry | 要使用的 NPM registry。 The NPM registry to use. | string | |
| --verbose | 在执行期间显示内部操作的详细信息。 Display additional details about internal operations during execution. | boolean | false | 
