Angular CLI Commands

Below are some of the important and useful Angular CLI commands that are useful while developing an Angular Application.

To install Angular CLI

npm install -g @angular/cli

To get online help

ng help

To get detailed help of a command

ng [command name] --help

To get Angular version details

ng version

or

ng --version

Read:- Angular Interview Questions

To create new Angular Project

ng new <ProjectName>

 To Build Angular Application

ng build

To build Angular Project and starts a web server

ng serve

To build and open Angular application in browser

ng serve --open

or

ng serve --o

To run an Angular App on a new port

ng serve --o --port <PortNumber>

 To generate a production build

ng build --prod

To generate a new component

ng generate component <ComponentName>

or

ng g c <ComponentName>

To create a service

ng generate service <ServiceName>

or

ng g s <ServiceName>

You may like other blogs –

MVC Tutorial
Web API Tutorial
Building Blocks of Angular
Learn TypeScript

Interview Questions and Answers Series –

MVC Interview Questions and Answers
Web API interview questions and answers

Prev – Angular Versions
Next – How to pass Data from one Component to Other Component in Angular?

Leave a Comment

RSS
YouTube
YouTube
Instagram