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
.
引數
引數 | 說明 |
---|---|
<collection> | 要新增的套件。 The package to be added. |
選項
選項 | 說明 |
---|---|
--defaults=true|false | 對有預設值的選項禁用互動式輸入提示。 Disable interactive input prompts for options with a default. |
--help= | 在控制檯顯示關於本命令的幫助資訊。 Shows a help message for this command in the console. 預設值: |
--interactive=true|false | 啟用互動式輸入提示。 Enable interactive input prompts. |
--registry=registry | 要使用的 NPM registry。 The NPM registry to use. |
--verbose=true|false | 在執行期間顯示內部操作的詳細資訊。 Display additional details about internal operations during execution. 預設值: |