Getting Started with Angular with Angular CLI

Written on Oct 29, 2017

Setting up project using angular cli is very easy task. We can create project up and running in three steps.

  1. Install Angular Cli
  2. Create new project using command line
  3. Build and start project

1. Installing Angular Cli

Open command prompt and fire up below command, which will basically install angular/cli package at global level.

npm install -g @angular/cli

2. Create new project

Make sure you are at preffered location in command prompt, then fire up below command. Here HelloWorldProject is name of project which we are creating here.

ng new CliDemo

3. Build and Start project.

Navigate to your project directory and then run project by using below command.

	cd CliDemo
	ng serve
	


It's done! When you execute "ng serve", first of all it will download any missing modules, then it will compile project and if all goes will it will start npm server. You'll be presented url where project is locally hosted. Generally it is hosted at "localhost:4200".

In summary below are the command which will get you going.

> npm install -g @angular/cli
> ng new CliDemo
> cd CliDemo
> ng serve