Getting Started with Angular2

    Sep 15, 2016       by Pankaj Kumar
angular2-basic-app.jpg

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

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

angular-cli

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

We can check its status with below command.

tsc -v

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

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

 

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

angular basic app

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.

You can download complete code from here. Download Code


WHAT'S NEW

Find other similar Articles here: