AngularJS 2 Basic Configuration And Differences Between AngularJS 2 And AngularJS


What are the differences between AngularJs and Angular 2?

  • First, Angular 2 is not the upgrade of Angular 1. Angular 2 is completely rewritten.
  • Angular 2 is using Typescript which is a super set of javascript (It doesn’t mean only typescript, dart also).
  • Angular 1.x was not built with mobile support in mind, where Angular 2 is mobile oriented.
  • Angular 1.x controllers are gone. We can say that controllers are replaced with “Components” in Angular 2.

What is the node JS?

  • JS is an open-source, cross-platform runtime environment for developing server-side Web applications.
  • Node.js is used for easily building fast, scalable network applications.
  • Node.js is a runtime that compiles and executes javaScript.
  • Both client side and server side use javascript code unlike most of today's applications with rich client framework (angularJs, extJs).

What is TypeScript?

  • TypeScript is a free and open-source programming language developed and maintained by Microsoft.
  • It is a strict superset of JavaScript, and adds optional static typing and class-based object-oriented programming to the language.
It is a scripting language.It is object oriented programming language(not pure).
Here is no static typing. ex: var num ;Here is static typing(We can declare a variable in multiple ways). ex: var num : number;
It don't have Interfaces .It has Interfaces.
It has no optional parameter feature .It has optional parameter feature .
It has no Rest Parameter feature.No Generics support.It has Rest Parameter feature.Supports Generics.
No Modules support.Here Number, String, etc are Objects.Supports Modules .Here Number, String, etc are Interfaces.

Basic Configuration Set up the Development Environment

Install Node.js® and npm if they are not already on your machine.

node –v, npm -v
npm install -g @angular/cli
npm install -g typescript

Create a new project

ng new my-app

Serve the application

cd my-app
ng serve --open