Tuesday, September 25, 2018

Advantages of Angular (2+) over AngularJS (1.x)

AngularJS (1.x) is based on MVC architecture, Angular (2+) is based on component based architecture.

AngularJS applications are driven by HTML or other web development frameworks like like Asp.Net MVC etc. and AngularJS directives were used to enhance the applications, Angular 2.0 brings a major shift to this, Angular is a platform by itself for developing Single Page Applications. Because of the architectural differences Angular applications provide better performance when compared to AngularJS applications.

AngularJS uses plain JavaScript to script the controllers and models. Angular components are written using TypeScript. TypeScript is a superset of JavaScript, which gets compiled to JavaScript before getting rendered to the browser.

AngularJS has a set of pre-defined directives, need to use the right directive at the right place like ng-show, ng-click etc. Angular simplifies this using the [] and () syntax. Property binding is done using [] and event binding is done using ().

Property Binding
AngularJS

<img ng-src=”{{item.image}}”>

Angular
<button [src]=”item.image”>
Event Binding
AngularJS

<button ng-click=”clickHandler()”>

Angular
<button (click)=”clickHandler()”>

AngularJS is not primarily mobile friendly, Angular 2.0 has made it possible to accomplish the native applications for a mobile platform like React Native.


Search Flipkart Products:
Flipkart.com

No comments: