Explore Design and features of angularjs 2.0

The current angularjs framework design in an amalgamation of the changing Web and the general computing landscape; however, it still needs some changes. The current Angular 1.x framework cannot work with new web components, as it lends itself to mobile applications and pushes its own module and class API against the standards. To answer these issues, the angularjs team is coming up with the angularjs 2.0 framework. angularjs 2.0 is a reimaging of angularjs 1.x for the modern web browser.

The following are the changes in Angular 2.0:

AtScript

AtScript is a language used to develop angularjs 2.0, which is a superset of ES6. It’s managed by the Traceur compiler with ES6 to produce the ES5 code and it will use the TypeScript’s syntax to generate runtime type proclamations instead of compile time checks. However, the developer will still be able to use the plain JavaScript (ES5) instead to using AtScript to write angularjs 2.0 applications. The following is an example of an AtScript code:

import {Component} from 'angular';

import {server} from './server';

@Component({selector: 'test'}) 

export class MyNewComponent {

  constructor(serve:Server){
     this.sever=server
  }
}

In the preceding code, the import and the class come from ES6. There are constructor functions and a server parameter that specifies a type. In AtScript, this type is used to generate a runtime type assertion. The reference is stored, so that the dependency injection framework can use it. The @Component annotation is a metadata annotation. When we decorate some code within @Component, the compiler generates code that instantiates the annotation and stores it in a known location, so that it can be accessed by the angularjs 2.0 framework.

About the author

Deven Rathore

Deven Rathore

I'm Deven Rathore, a multidisciplinary & self-taught designer with 3 years of experience. I'm passionate about technology, music, coffee, traveling and everything visually stimulating. Constantly learning and experiencing new things.

Pin It on Pinterest

Shares