DEV Community

Cover image for Getting Started with Angular2
Pankaj Kumar
Pankaj Kumar

Posted on • Updated on

Getting Started with Angular2

As we all know that Angular 2 is much popular among the js frameworks nowadays. So today I am going to start the angular2 demo here at jsonworld.

So lets start today angular2 from the very basic app.

Starting with Angular2 Dependencies installation.

At first we need node.js and npm installed in our system to proceed. Then we need to install angular command line module. For that we need to run following command over terminal.


sudo npm i -g angular-cli

Enter fullscreen mode Exit fullscreen mode

After completing installation from above we can check if it installed properly or not.


angular-cli

Enter fullscreen mode Exit fullscreen mode


The angular command line is officially tool provided by Google Angular2 team to create, manage the Angular project. It follows the best standard and code practices recommended by the Angular team.

Install Typescript

So now move to the next step, Installation of TypeScript. So still typescript is not installed in the system then run the below command to install TypeScript.


sudo npm i -g typescript

Enter fullscreen mode Exit fullscreen mode

We can check its status with below command.


tsc -v

Enter fullscreen mode Exit fullscreen mode

It will return the version of the TypeScript.

Angular2 app creation

So in the next step, for creating new app in angular2 using cli, we need to run below command that will create basic setup for angular2 applicaiton


ng new jsonworld-test-app

Enter fullscreen mode Exit fullscreen mode

The above command will create a new folder name provided above in the command. This command will run npm install at background to install node.js related dependencies. To run the above app create go inside the newly created folder with cd jsonworld-test-app/ and run the below command.


ng serve or npm start

Enter fullscreen mode Exit fullscreen mode

Now our aim is fulfilled, angular2 basic app is created. Now we can check the basic app by typing http://localhost:4200

Image description

Finally Its works fine.

For reading the detailed document on the angular cli and basic stucture, visit the official site of angular.

Next Demo

In the next demo we will learn to create a static website on angular2

Conclusion

Getting started with Angular2 is really easy using Angular command line interface.

This article is originally posted over jsonworld

Top comments (0)