ANGULARJS 2.0 What are the new features _angularjs

Source: Internet
Author: User
Tags es6 class

Angularjs has become the most popular Open-source JavaScript framework in the Web application development world. Since its inception, it has witnessed astonishing economic growth and the support and adoption of groups – including individual developers, businesses, and communities.

Angular has become a client MVW framework (MODEL-VIEW-WHATEVER) for building complex single page applications. It plays an important role in application testing and application authoring, while simplifying the development process.

Angular's current version is 1.3, which is stable and has been used by Google (framework maintainers) to support numerous applications (it is estimated that more than 1600 applications in Google run in Angular1.2 or 1.3). Angular 2.0 officially announced with the Nigerian conference last October that the version would not be a complex and significant update.

Why launch Angular 2.0?

Before we discuss angular 2.0 (the estimated release date is 2015 end), let's simply think about the philosophy behind the new version. Angular 2.0 development starts with the following issues:

Mobile: The new version will focus on the development of mobile applications. The basis is that it's easier to deal with desktop things, and when the challenge involves moving (performance, load time), focusing on this will solve the problem.

Modularity: Each module will be removed from the core of the angular to achieve better performance. This means you can choose the parts you need.
Modernization: Angular 2.0 will target ES6 and "evergreen" modern browsers (automatically updating to the latest version). This means that developers can focus on the business domain-related code.

What are the controversies?

There was no mention of the migration to version 2.0 at the Nigerian meeting. It also points out that the jump to version 2.0 will break the original version 1.3 application without any backward compatibility. Since then the developer community has been awash with uncertainty and speculation, and some developers are beginning to question whether it is worthwhile to start a new angular 1.3 project.

What changes are there?

Atscript

Atscript is a parent set of ES6 that is used to develop the angular 2.0. Instead of a compile-time check, it is handled by the Traceur compiler (along with ES6) to generate the ES5 code and to generate an assertion of the execution time with the typescript type syntax. However, Atscript is not mandatory, you can still use pure JAVASCRIPT/ES5 code instead of Atscript to write angular applications.

Improved dependency (DI)

The basic idea of the dependency injection (Dependency injection) pattern is that the client class client does not have to initialize its dependent member variable iserver, using a separate object to create iserver the appropriate implementation class and assign it to the client's member variable. It is particularly useful for module development and component isolation. Angular 2.0 will solve the problem of angular 1.X. Add missing attributes, such as child injectors and lifetime/scope control.

Annotations

Atscript provides tool-associated metadata and functionality. This helps build an object instance that provides the necessary information to the DI library (calls a function or creates an instance of a class when examining the related metadata). It is also easy to overload parameter data by providing an annotation.

Child Injectors

A child injector inherits all the performance services of its parent class. Depending on the requirements, different types of objects can be invoked and automatically overwrite different scopes.

Instance scope

The Improved DI library will feature an instance scope, which becomes more powerful when using child injectors and its own scope identifier.

Templates and data binding

In development applications, templates and data binding will move in tandem.

Dynamic load

This is a feature missing from the current angular version, but will appear in angular 2.0. This will allow developers to add new instructions or controllers to their busy life.

Template

In angular 2.0, the template compilation process will be asynchronous. Because the code is based on the ES6 module specification, the module loader loads dependencies through a simple reference component definition.

Instructions

There will be three instructions in Angular 2.0:

Component Directives-these will create reusable components using JavaScript, HTML, or an optional CSS style sheet's encapsulation logic.

Decoration Directives-these directives are used to decorate elements (such as adding a ToolTip, or using ng-show/ng-hide to show/hide elements).

Template directives--these will change the HTML to a reusable template. The instantiation of the template and its embedding into the DOM can be completely controlled by the command. Examples of this include ng-if and ng-repeat.

Routing Scenarios

The initial angular route is designed to handle some simple situations. However, with the development of the framework, more and more functions are added. The Angular 2.0 road is already extensible, and it will contain the following basic features:

Simple JSON-based routing configuration;

An optional agreement that is superior to configuration;

Static. parameterized routing mode;

URL parser;

Support query string;

Use push status or Hashchange;

Navigation model (generating a navigation UI);

Document title Update;

404 routing processing;

Location Service;

Historical operations.

Now, let's take a look at the routing features that allow angular 2.0 to reach a new height:

Sub-route

Sub-routing translates each component of the application into smaller applications by providing them with their own routing, which helps encapsulate the set of attributes for the entire application.

Screen activation

This will help developers to better control the life cycle of navigation through a set of can* callbacks:

canactivate--allows/prevents navigation to the new controller;

activate--response succeeded to the navigation of the new controller;

candeactivate--allows/prevents navigation away from the old controller;

deactivate--response successfully away from the old controller's navigation;

These callbacks will allow the developer to return a Boolean value or a command (for lower levels of control).

Design

All of these logic is built using a pipelined structure that makes it easy to add its own steps to the pipeline or remove the default. In addition, its asynchronous nature will allow developers to use server requests for authentication or load data for the controller, but this is still planned.

Log

Angular 2.0 will contain a log service called Diary.js-a very useful feature that measures where you spend your time in your application.

Scope

$scope will be removed from angular 2.0 and replaced by the ES6 class.

Conclusion

As the release date approaches, the excitement and sound surrounding angular 2.0 will intensify. Is it a good thing to break change? We don't know, but it's understandable that opponents feel nervous because there is a clear lack of plans to move. The Duang is coming. But since it is coming, what we can do is to positively greet it.

The above content has introduced the ANGULARJS 2.0 new characteristic, hoped that has the help to everybody!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.