Angular released the official version 1.5, focusing on the transition to Angular2 _ AngularJS

Source: Internet
Author: User
Angular team recently released the official version of Angular1.5, which implements a major upgrade and is still in use. developers of Version X will be able to more easily transition to Angular 2's Development Angular team recently released the official version of Angular 1.5, which has implemented a major upgrade and is still in use. developers of Version X can easily transition to development of Angular 2.

Pete Bacon Darwin wrote in his blog post on this release statement that the purpose of this release is to "improve Angular 2's upgrade path. We introduced some new features in this release, so that the Angular 1 application written by developers is closer to the application structure in Angular 2 ."

In this release, the new module. component () auxiliary method is the biggest change in the transition to Angular 2. By using this method, developers no longer have to follow the traditional directive defined object style to write directive. If you are familiar with Angular 2, you should note this similarity. In this article, the author uses an example to demonstrate how to define a new component:

myModule.component('myComponent', {template: 'Hello {{ $ctrl.getFullName() }}',bindings: { firstName: '<', lastName: '<' },controller: function() {this.getFullName = function() {return this.firstName + ' ' + this.lastName;};}});

Before the emergence of component, developers can only use direve ve, or achieve certain scenarios through unconventional use of controller. However, this does not mean that component will completely replace direve VE. For example, component cannot be used to operate DOM, and all component must be activated through custom HTML elements, it cannot be triggered by element attributes. The component defined in the preceding method can be used using the following code:

 

The new component Guide provides a more complete description of the differences between the traditional direve VE and component.

One-way binding

Lifecycle hook

Bind to required ve

Supports transclusion for multiple slots

Default transclusion content

Currently, developers using version 1.4 can read the Migration Guide to learn about the required changes during migration, because some destructive changes are introduced in version 1.5.

For the foreseeable period, version 1.5 should be the largest change. When InfoQ asked Bacon Darwin where the 1.x version was going, he replied as follows:

We have not started to plan the next release cycle of Angular 1. Since Angular 2 has been officially released more and more recently, if we continue to develop Angular 1, we will try to make it closer to Angular 2. If disruptive changes must be introduced to achieve this, the emergence of version 1.6 is expected. At the same time, we will continue to develop Angular 1.5.x to provide bug fixes and some minor features. In short, this does not conflict with our goal of making Angular 1.x easier to migrate to Angular 2.

The new component router feature should be released later this week. If you are interested, please follow the script home website!

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.