Getting Started With Angular 2 Using Angular CLI

In this article, I will demonstrate how to install Angular CLI and how to set up an Angular project and run it.

Why Angular CLI?

Angular CLI is a command line interface tool that can create a project, add files, and perform a variety of ongoing development tasks such as testing, bundling, and deployment.

Before moving ahead, if you want to read my previous Angular 2 samples without Angular CLI, here is the list,

Getting Started,

Follow these steps,

Step 1

First of all make sure your machine has Node.js and npm installed. You can install it from here.

Step 2

Now install Angular CLI using a command prompt. Install Angular CLI globally.


Step 3

After installing Angular CLI, now create a new project. First of all provide project directory path and hit enter.

Step 4

Then give this command and hit enter, here fourth-sample is my application name, you can give any name.

Step 5

Wait until all files are added.

Step 6

If you check directory then all files are added like this, it means the application is created and all required files are added.

Step 7

Now run the project, go to project directory using command prompt and hit this command and wait until command is completed.

Step 8

As you can see, the application is running in the browser without writing any lines of code or added built in files. Now you can add models, components, html and style sheets.


In this article, I explained the very basic steps of how to get started with Angular CLI. If you have any questions or comments, drop me a line in the comments section.