Angular CLI Tutorial
Angular CLI Useful Resources
Selected Reading
- Angular CLI - Code Coverage
- Angular CLI - ng xi18n
- Angular CLI - ng update
- Angular CLI - ng doc
- Angular CLI - ng config
- Angular CLI - ng analytics
- Angular CLI - ng add
- Angular CLI - ng e2e
- Angular CLI - ng test
- Angular CLI - ng lint
- Angular CLI - ng serve
- Angular CLI - ng run
- Angular CLI - ng build
- Angular CLI - ng generate
- Angular CLI - ng help
- Angular CLI - ng new
- Angular CLI - ng version
- Angular CLI - Environment Setup
- Angular CLI - Overview
- Angular CLI - Home
Angular CLI Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Angular CLI - ng add
Angular CLI - ng add Command
This chapter explains the syntax, argument and options of ng add command along with an example.
Syntax
The syntax for ng add command is as follows −
ng add <collection> [options]
ng add a npm package to workspace.
Arguments
The argument for ng add command is as follows −
Sr.No. | Argument & Syntax | Description |
---|---|---|
1 | <collection> | The name of the package to be added. |
Options
Options are optional parameters.
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,which is available at
Now run the add command.
Example
An example for ng add command is given below −
>Node>TutorialsPoint> ng add @angular/pwa Instalpng packages for toopng via npm. Installed packages for toopng 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) √ Packages installed successfully.Advertisements