Angular CLI

Reading Time: 2 minutes

Angular CLI stands for Angular Command Line Interface. It is a command-line tool to generate Angular applications. It will create all needed plumbing to get everything up and running in a matter of minutes, generating an application structure that is based on best practices for an Angular project.

Angular CLI helps to create an angular application that can just run without writing any code by including all the dependencies that are required to create and run your angular application.


  • create a new Angular application
  • run a development server with LiveReload support to preview your application during development
  • add features to your existing Angular application
  • run your application’s unit tests
  • run your application’s end-to-end (E2E) tests
  • build your application for deployment to production.

Angular CLI most used commands

  • ng new <<your project name>>: Create a new Angular app with the provided name
  • ng update: updates your apps & its dependencies
  • ng generate <<component|directive|pipe|service|guard|interface|enum|module>> <<class name>>: Used to create the Angular components. You can create any of the angular related files
  • ng serve: Run your angular Application
  • ng build: Create an application for deployment
  • ng lint: Run codelyzer to analyse code
  • ng test: Run unit tests with KARMA

Create An Angular App Using Angular CLI

Firstly, we need to install the Angular CLI in your local machine. Please make sure you have installed node in your machine.

npm install -g @angular/cli

Please notice we are using the -g flag to install this globally on our system. Now we should be able to run ng verson to see what version we are running:

Creating a Project

ng new my-angular-app

While creating the Angular CLI prompts you to choose the Angular routing and stylesheet formats you want to add as part of your angular application.

Now we have a full Angular application ready to run. You can see the folder structure and the files that get generated for us.

Run the Angular App

You can execute the below command to run the application.

ng serve

Once the application build is successful, you would see your angular application open in the browser tab.

0 0 vote
Article Rating