Angular CLI - ng add Command


Advertisements

Syntax

ng add <collection> [options]

ng add a npm package to workspace. Options are optional parameters.

Arguments

Sr.No. Argument & Syntax Description
1 <collection> The name of the package to be added.

Options

Sr.No. Option & Syntax Description
1 --defaults=true|false When true, disables interactive input prompts for options with a default.
2 --help=true|false|json|JSON

Shows a help message for this command in the console.

Default: false

3 --registry=registry The NPM registry to use.
4 --verbose=true|false

Display additional details about internal operations during execution.

Default: false

First move to an angular project updated using ng build command.

Now run the add command.

Example

\>Node\>Howcodex> ng add @angular/pwa
Installing packages for tooling via npm.
Installed packages for tooling via npm.
CREATE ngsw-config.json (620 bytes)
CREATE src/manifest.webmanifest (1352 bytes)
CREATE src/assets/icons/icon-128x128.png (1253 bytes)
CREATE src/assets/icons/icon-144x144.png (1394 bytes)
CREATE src/assets/icons/icon-152x152.png (1427 bytes)
CREATE src/assets/icons/icon-192x192.png (1790 bytes)
CREATE src/assets/icons/icon-384x384.png (3557 bytes)
CREATE src/assets/icons/icon-512x512.png (5008 bytes)
CREATE src/assets/icons/icon-72x72.png (792 bytes)
CREATE src/assets/icons/icon-96x96.png (958 bytes)
UPDATE angular.json (3803 bytes)
UPDATE package.json (1332 bytes)
UPDATE src/app/app.module.ts (682 bytes)
UPDATE src/index.html (482 bytes)
&Sqrt; Packages installed successfully.
Advertisements