BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Angular Releases Version 1.5, Narrows Focus

Angular Releases Version 1.5, Narrows Focus

Bookmarks

The Angular team has released version 1.5, completing a major upgrade that brings 1.X developers closer to what they'll encounter in version 2.

In the announcement blog post, Pete Bacon Darwin says that the goal of this release was "to improve the upgrade path to Angular 2. In this release we have added features that will enable developers to write Angular 1 applications that are closer to the way that applications are structured in Angular 2."

The biggest move towards Angular 2 is the introduction of the new module.component(). This new helper aims to eliminate the need for developers to write directives in the traditional directive definition object style. Those familiar with Angular 2 will notice the similarity. From the post, here's an example of how to define a new component:

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

These new components can be used in some scenarios where developers previously would have created a directive or over-used a traditional controller. But, it's not a complete replacement for traditional directives. For example, components can't be used for DOM manipulation and all components have to be triggered with a custom HTML element; attribute directives are not supported. A component as defined above is used like this:

<my-component first-name="'Alan'" last-name="'Rickman'"></my-component>

The new component guide provides a more complete overview of the differences between classic directives and components.

  • One-way bindings
  • Lifecycle hooks
  • Binding to required directives
  • Multi-slot transclusion
  • Default transclusion content

Developers on version 1.4 can read the migration guide to see what changes are required as version 1.5 has breaking changes.

This is expected to be the biggest release for the foreseeable future. Asked by InfoQ about how 1.X will proceed, Bacon Darwin said:

We haven't started planning the next release cycle for Angular 1. Since we are getting close to the GA release of Angular 2, we do not expect to be developing Angular 1 in any way that doesn't move it closer to Angular 2. If breaking changes are required in order to achieve this then you can expect a 1.6 release. In the meantime we are continuing to work on Angular 1.5.x with bug fixes and minor features that do not diverge from the aim of making it easier to upgrade to Angular 2.

The new component router is expected to be released later this week.

Rate this Article

Adoption
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

  • What a mess... Just use React.

    by Clinton Begin,

    Your message is awaiting moderation. Thank you for participating in the discussion.

    The transition will be non-trivial and for little gain. I would recommend to anyone making the move to give serious consideration to React. My bet is that you can rewrite your app in React, faster and cleaner than you can port it to Angular 2 --or even continue to maintain it with Angular 1.x. IMHO...hth.

  • drop the use of "drop"

    by Ken Geis,

    Your message is awaiting moderation. Thank you for participating in the discussion.

    Please mind your wording. The word "drop" can refer to abandoning something, and I think that usage is more common than "deliver" (at least outside of pop music.) From the headline, I expected this article to be about the opposite of what it actually was.

  • Re: drop the use of "drop"

    by David Iffland,

    Your message is awaiting moderation. Thank you for participating in the discussion.

    Ken,

    You're right about this. I've updated the title to avoid the ambiguity. Thanks.

  • Re: drop the use of "drop"

    by Greg Liebowitz,

    Your message is awaiting moderation. Thank you for participating in the discussion.

    You must admit, "drop" made for an excellent click-bait headline. :)

  • Re: What a mess... Just use React.

    by Brendan Alexander,

    Your message is awaiting moderation. Thank you for participating in the discussion.

    I don't have experience with React. I am sure it is great, and eventually I will try it. Since angular2.beta as come out I have done two production level web apps with it, and I find it is very easy to learn and implement. Performance is excellent, and I am now pitched toward the future of javascript, vis a vis components and Ecmascript 6 and beyond. Furthermore, I like the angular2 ecosystem, especially the use of Typescript, and only expect it to get better as it moves toward final release and beyond. Porting from Angular 1.x to 2 is well worth it in my opinion.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

BT