AngularJS 1.2

2013-10-18 00:00:00 +0100 by Alex R. Young

RC3 for AngularJS 1.2 was announced recently, with the news that the official 1.2 release should be out next week. There's a full changelog at the AngularJS GitHub repository.

This release has some major changes: ngAnimate has been rewritten, $q gets a shorthand for error handlers (.catch), forms can now be addressed with $scope.ctrl.form instead of $scope.ctrl.form, and jQuery 1.10.x is supported.

Some annoyances have been fixed as well. $httpBackend can set headers with falsy values, $log no longer prints undefined in IE, and numberFilter will use toFixed() to ensure that large numbers are formatted as expected rather than using scientific notation. There are many more bug fixes documented in the changelog.

This release will introduce breaking changes. Promise unwrapping has been deprecated:

This is a feature that didn't prove to be wildly useful or popular, primarily because of the dichotomy between data access in templates (accessed as raw values) and controller code (accessed as promises).

Here's an interesting one: inputs cannot have a name of hasOwnProperty:

Before, inputs whose name was "hasOwnProperty" were quietly ignored and not added to the scope. Now a badname exception is thrown.

The biggest changes are due to the ngAnimate rewrite. The latest documentation for that is available here: lastSuccessfulBuild/ngAnimate.

The animate service will automatically apply two CSS classes to the animated element and these two CSS classes are designed to contain the start and end CSS styling. Both CSS transitions and keyframe animations are supported and can be used to play along with this naming structure.

JavaScript animations are also supported:

JavaScript-defined animations are created with a CSS-like class selector and a collection of events which are set to run a javascript callback function. When an animation is triggered, $animate will look for a matching animation which fits the element's CSS class attribute value and then run the matching animation event function.

From what I can tell the breaking changes sound sensible, so it looks like most projects will just need to verify the use of the animate service.