Wednesday, April 26, 2017

Major Difference between Angular 1 and Angular 2

Angular-2 is not the upgrade of Angular-1. Angular 2 is completely rewritten. Angular 1.x was not built with mobile support in mind, where Angular 2 is mobile oriented. Some, Major difference between Angular-1 and Angular-2 I listed here.

   ✥ Welcome TypeScript, Good-Bye JavaScript
Although TypeScript is a superset of JavaScript but there has been introduced a lot of new concepts like classes, let, const, import/export, and arrow functions.

     ✥ Welcome component, Good-Bye Controller and $scope
Using Controller and $scope in Angular-1  are no longer used in Angular-2. They have been replaced by components and directives. Components are directives with a template.

    Welcome Bootstrapping, Good-Bye ng-app
Using  ng-app attribute to connect an Angular App in Angular-1 is no longer used in Angular-2. Instead of, Angular-2 has been introduced with new technique called Bootstrapping.In Angular-1 ng-app attribute directive has been used to connect angular modules to a view. This process, has been changed with bootstrapping in Angular-2.

   ✥ Many basic directives, filters, and services do not exist until they have been imported in Anugar-2 but in Angular-1 there is no need to imported
In Angular-1, this was true for things like services (e.g. $http), but now we have to import basic directives like NgModel first (amongst other things). Firstly, it seems that it would be burdening but later, it seems that it ultimately allows  to explicitly control the overhead of your Angular applications which is a good thing.

No comments:

Post a Comment