Site icon CodePortal

Starting with Angular2

Before we jump to coding section let me point out some differences between AngularJS and Angular2 which everyone should know.

Now that you’ve got basic information about What’s difference between both versions we’ll start basic coding in Angular2.

Open your command prompt and install angular-cli using following command:

npm install -g angular-cli

This will install Angular2 command line interface so now you can use ng command directly.

Once this is done create new angular2 application using:

ng new basic

It’ll create new directory basic and install dependecies into that folder. Once this is done you’re almost done.

Now, just cd into that directory and run one last command to start ng server:

ng serve

That’s it! Your app will be served on 4200 port. Open localhost:4200 and you can see your app up & running! 🙂

Next time we’ll be creating sample Angular2 component Your first Angular2 Component and after that we’ll play with events and refs in Angular2.

Till then try understanding structure and code!!!

Exit mobile version