Angular CLI Commands


Below are few 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


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 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?

Comments

Popular