First thing to be clear is AngularJs 2is not an upgrade of Angular, it is completely different from Angular Js 1
Angular JS 1.X
|
Angular 2
|
Setting up application is very easy, need to just add the reference of angular.js | Setting up application is quite complex, and it takes lot of work because it’s dependent on Gulp or Grunt. |
Angular JS is not built with mobile support in mind. | Whereas Angular2 was built for specially taking care of mobile support, so it’s mobile oriented. |
Angular JS core concept was $scope, without scope we can’t communicate between views and controller. | Angular2 is using Zone.js for detecting changes made in the DOM. |
For communicating with views/templates it require controllers. | It’s build with components. Template Directives + controllers = components |
Performance is less when compared to angular2. | Unidirectional tree based change detection increases its performance. As per ng-conf angular 2 is five times faster than angular1. |
Angular1.X has ES5, ES6 and Dart | Whereas angular2 has more choice, it can use any of the languages from ES5, ES6, and typescript/dart. |
Ng-repeat is used for iterating through list of objects. | Structural directives syntax is completely changed. Ng-repeat is replaced with *ngFor |
Mostly built-in directives are used for events and element properties. Ex: ng-src, ng-href, ng-click etc. | It directly uses the HTML DOM element properties. Ex: (click) |
Ng-bind is used for one-way binding | Whereas ng-bind is replaced with [property], where property is HTML DOM element property. |
It has two ways to bootstrap the application, one is automatic bootstrapping (ng-app) and manual bootstrapping. | It has only one way which is manual bootstrapping. |
For routing it uses $routeProvider.when() | It uses @RouteConfig {{…}} |
No comments:
Post a Comment