Setting up a project using Angular CLI is a very easy task. We can create a project up and running in three steps.
1. Install Angular CLI
Open command prompt and fire up below command, which will basically install angular/cli package at a global level.
npm install -g @@angular/cli
2. Create a New Project
Make sure you are at your preferred location in the command prompt, then fire up the below command. Here HelloWorldProject is the name of the project which we are creating here.
ng new CliDemo
3. Build and Start the Project.
Navigate to your project directory and then run the project by using the 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 the project and if all goes well it will start the npm server. You’ll be presented URL where the project is locally hosted. Generally, it is hosted at “localhost:4200”.
In summary below is the command which will get you going.
> npm install -g @@angular/cli
> ng new CliDemo
> cd CliDemo
> ng serve