Monday, 6 June 2016

A Deep dive into Angular 2 basics and difference between the versions


In this post we are going to see the new features present in the Angular 2, and the differences between the version 1.x and 2.0

First of all, i don't knew who is the person recommends the Angular 2 with, this kind of major changes, now currently angular 1.x versions are have a good popularity among the developers which is very easy to develop a single page applications. angular 1.x versions have many major advantages which makes that popular among the industry.

Features:
1. Two way binding
2. Routing
3. Change Detection
4. Directives
5. Services.
6. Controllers and the Scope concept.

Mainly the Two way binding makes the good feedback among the developers to develop the UI far better than any other framework. But recently google decide to soon release the angular 2 which have some major break changes in the framework.  Google and Microsoft are jointly working in the angular 2 framework,  angular 2 uses Typescript. 

Changes or features present in Angular 2

1 .No more Two way binding
      The major change is there is no more two way binding present in angular , all are uni directional, actually the thing which makes the angular popular among the industry in Two way binding ng-model, i.e is no more present in the up coming release. Angular team clearly indicates that unidirectional flow of data will be present in the angular 2., Here after there is no more $digest loop every time when ever a two way binding occurs.

2. New Router:
      The new release consists of a new router concepts.

3. No $scope
       Hereafter there is no concept called $scope , for a newbie to learn the concept of $scope is difficult, so to avoid the difficulties in learning they removed that concept

4. No Controller
       Angular 2 remove the concepts of controller , rather they uses the concept called web components where every component consists of View, component and class implementation.


@Component({
  selector: 'emp-view',
  componentServices: [
    emplist
  ]
})
@Template({
  url: './templates/emp-view.html',
  directives: [Foreach]
})
class EmpView{
  constructor() {
    this.employees = emplist.get();
  }
  addEmp(newemp) {
    this.employees.push(newemp);
  }

}

5. Fast change detection:
     Angular team changed the change detection mechanism for the newer version, new version refers many libraries implementation about change detection so angular team decided to give a optimized change detection.

6.Written in Typescript
   Angular 2 is written in Typescript , Typescript is statically typed language, so we can get the type errors in compile time itself , typescript is a superscript of ES6, ES6 is a superset of ES5. which are being transpiled to javascript

7 Virtual Dom concept 

8. Improved Dependency Injection

9. supporting mobile

But angular 2 doesnt have a backward compatibility support, so  many applications which are developed in version 1.x can use that if there is no performance issue, because if they want to change or migrate to version 2.0 then it is a huge cost for them, it is better to have a library which have more features than compact small performance increase.

from my concern google destroying the growth of  angular by giving a major change especially in removing of two way binding.

From this post you can see some of the changes takes place in the angular 2 version.


No comments:

Post a Comment