How to create first project with Angular 2/4/5?

In last article we have discussed about how to setup environment for the angular 2/4/5.
In this article I explained how to setup your first project with angular 2/4/5.

First need to open your command prompt( cmd ). Fastest way to open a command prompt is press Win+R on your keyboard. Write “cmd” for opening command prompt terminal . After opening it and type which directory you want to create the angular project. First you go to that directory and then create a folder for your applications.

After that you need to check  correctly install “npm” in your system.  For check, type “npm  version” also attached with the video.

Now we need to install “Angular CLI”. To install this, you need to run following command in your prompt “npm install -g @angular/cli” then press enter key to install module in your angular. After installation run “ng help” command to check usages of it. Now we need to start create new project that you need to run following command “ng new myfirstproject”  in “myfirstproject” you need to write your application’s name. Then it will takes some times to create the project. After successfully installing that, you need to go there  directory. For example “cd myfirstproject”. To Run angular applications,  it required to  run “ng serve”. It compiled your applocation and you  need to open “http://localhost:4200/” to see the project, attached a video below.

It takes some time to install the application. After successful message you required to change directory and run “ng serve”  display in video shown below.

You need to run the “http://localhost:4200/” in your browser. It will display first page of your application attached below screenshot.

These simple steps help you for starting  your first application with angular. In my next article I discuss about the coding structure of the angular. How to setup routing for your application?


Spread the love
  • 58
  • 4
  • 1