
- Angular Tutorial
- Angular - Home
- Angular - Overview
- Angular - Features
- Angular - Advantages & Disadvantages
- Angular Basics
- Angular - Environment setup
- Angular - First Application
- Angular - MVC Architecture
- Angular Components
- Angular - Components
- Angular - Component Lifecycle
- Angular - View Encapsulation
- Angular - Component Interaction
- Angular - Component Styles
- Angular - Nested Components
- Angular - Content projection
- Angular - Dynamic components
- Angular - Elements
- Angular Templates
- Angular - Templates
- Angular - Template statements
- Angular - Template Variables
- Angular - SVG as Templates
- Angular Binding
- Angular - Data Binding
- Angular - Interpolation
- Angular - Event Binding
- Angular - Property Binding
- Angular - Attribute Binding
- Angular - Class Binding
- Angular - Style Binding
- Angular - Two-way Binding
- Angular Directives
- Angular - Directives
- Angular - Attribute Directives
- Angular - Structural Directives
- Angular - Custom Directives
- Angular Pipes
- Angular - Pipes
- Angular - Built-in Pipes
- Angular - Custom Pipes
- Angular Forms
- Angular - Forms
- Angular - Template Driven Forms
- Angular - Reactive Forms
- Angular - Form Validation
- Angular - Dynamic Forms
- Angular Dependency Injection
- Angular - Dependency Injection
- Angular - Injectable Service
- Angular Routing
- Angular - Routing
- Angular - Dynamic Routes
- Angular - Wildcard Routes
- Angular - Nested Routes
- Angular - Navigation
- Angular - Routing in SPA
- Angular - Custom Route Matches
- Angular - Router Reference
- Angular HTTP Client programming
- Angular - Services
- Angular - HTTP Client
- Angular - Request
- Angular - Response
- Angular - GET
- Angular - POST
- Angular - PUT
- Angular - DELETE
- Angular - JSONP
- Angular - CRUD Operations Using HTTP
- Angular Modules
- Angular - Introduction to Modules
- Angular - Root Module
- Angular - Feature Module
- Angular - Sharing Module
- Angular - Routing Module
- Angular - NgModules
- Angular Animation
- Angular - Animations
- Angular Service Workers & PWA
- Angular - Service Workers & PWA
- Angular Testing
- Angular - Testing Overview
- Angular Design Patterns
- Angular - Design Patterns
- Angular - Lazy Loading
- Angular - Singleton Pattern
- Angular - Observer Pattern
- Angular Libraries
- Angular - Libraries
- Angular - Angular Material
- Angular - PrimeNG
- Angular - RxJS
- Angular Advanced
- Angular - Signals
- Angular - Authentication & Authorization
- Angular - Internationalization
- Angular - Standalone Component
- Angular - Accessibility
- Angular - Web Workers
- Angular - Server Side Rendering
- Angular - Ivy Compiler
- Angular - Building with Bazel
- Angular - Backward Compatibility
- Angular - Reactive Programming
- Angular Tools
- Angular - CLI
- Angular Material UI Elements
- Angular - Paginator
- Angular - Datepicker
- Angular - Select Drop-down
- Angular Miscellaneous
- Angular - Third Party Controls
- Angular - Configuration
- Angular - Displaying Data
- Angular - Decorators & Metadata
- Angular - Basic Example
- Angular - Error Handling
- Angular - Testing & Building a Project
- Angular - Lifecycle Hooks
- Angular - User Input
- Angular - What's New?
- Angular Useful Resources
- Angular - Quick Guide
- Angular - Useful Resources
- Angular - Discussion
Angular - CLI Commands
Angular CLI, a short form of Angular Command Line Interface, is a tool used for creating and managing Angular applications. It is built on top of Node.js and installed from NPM. It provides a set of commands to generate, build, test, and deploy Angular projects.
With the help of Angular CLI, developers can quickly set up a new project, add components, services, directives and any other features. This tutorial explains all the Angular CLI commands in detail.
Node.js is a runtime environment that allows you to run JavaScript code outside of a web browser. NPM (Node Package Manager) is a tool that comes with Node.js and helps you manage packages and dependencies for your projects.
Verify CLI
Before moving to Angular CLI commands, we have to ensure that Angular CLI is installed on your machine. If it is installed, you can verify it by using the below command −
ng version
After running this command, you may see the following response −

If CLI is not installed, then use the below command to install it −
npm install -g @angular/cli
For MAC or Linux operating systems, use the below command −
sudo npm install -g @angular/cli
Angular CLI Commands
There are a number of CLI commands used to manage Angular applications and all of them start with the prefix ng, which stands for Angular. Some of the Angular CLI are listed in the table given below −
SNo. | Commands & Descriptions |
---|---|
1. |
ng new <project-name> To create an Angular application. |
2. |
ng generate component <component-name> To create a component in Angular. |
3. |
ng generate class <class-name> To create a new class in Angular. |
4. |
ng generate pipe <pipe-name> It creates a custom pipe in Angular. |
5. |
ng generate directive <directive-name> It creates a new directive in Angular. |
6. |
ng generate module <module-name> To create a new module in Angular. |
7. |
ng generate interface <interface-name> It is used to create an interface in Angular. |
8. |
ng generate webWorker <webWorker-name> It creates a new web worker. |
9. |
ng generate service <service-name> It creates a new service. |
10. |
ng generate enum <enum-name> It generates a new enum. |
11. |
ng add [name] It is used to add support for an external library to your project. |
12. |
ng build It is used to compile or build your angular app. |
13. |
ng config It is used to retrieve or set Angular configuration values in the angular.json file for the workspace. |
14. |
ng config It is used to retrieve or set Angular configuration values in the angular.json file for the workspace. |
15. |
ng doc <keyword> This command opens the official Angular documentation in a browser, and searches for a given keyword. |
16. |
ng version Shows the Angular CLI version. |
17. |
ng update Updates your application and its dependencies. |
18. |
ng test Runs unit tests in a project. |
19. |
ng serve It is used to build and serve your app. Also, rebuilds on file changes. |
20. |
ng help It lists out available commands and their short descriptions. |
21. |
ng e2e <project> [options] It build and serves an Angular app, and then runs end-to-end tests using Protractor. |
22. |
ng deploy Deploy your Angular application to a specific hosting service, such as Firebase or GitHub Pages. |
23. |
ng cache clean Deletes the disk cache. |
24. |
ng cache info Displays the disk cache configuration and statistics. |
25. |
ng analytics disable It will disable the analytics gathering and reporting for the user. |
26. |
ng analytics info Displays the collected analytics. |