Google has this week announced version 1.3.0 of AngularJS, code named "superluminal-nudge".
The major release brings many enhancements, including improved APIs, performance boosts, and bug fixes.
Announcing the release in the article "AngularJS 1.3.0 – superluminal-nudge", Brian Ford -- developer program manager for Google -- elaborated on the improvements, saying:
[AngularJS] 1.3.0 has substantial performance improvements that reduce memory consumption, increase the speed of common DOM operations, and improve overall latency of Angular app.
By popular demand, AngularJS now officially has packages published to npm. You can do
npm install angular
to get AngularJS 1.3.0. We hope this makes it easier for developers to make use of some of the great tools built around npm for front-end web development
Among the notable new features included in Angular's latest release is several new directives, one of the most significant being ngMessages
. According to the AngularJS docs:
The
ngMessages
directive listens on a key/value collection which is set on thengMessages
attribute. Since the ngModel directive exposes an$error
object, this error object can be used with ngMessages to display control error messages in an easier way than with just regular angular template directives.
<form name="myForm">
<input type="text" ng-model="field" name="myField" required minlength="5" />
<div ng-messages="myForm.myField.$error">
<div ng-message="required">You did not enter a field</div>
<div ng-message="minlength">The value entered is too short</div>
</div>
</form>Now whatever key/value entries are present within the provided object (in this case $error) then the ngMessages directive will render the inner first ngMessage directive (depending if the key values match the attribute value present on each ngMessage directive).
Along with new features and improvements, Ford mentions that Angular's 1.3 release includes "over four hundred bug fixes."
The GitHub changelog for the project doesn't list in detail all 400 of the bug fixes, but among the improvements is a fix for $browser
-- where previously, in Internet Explorer 10-11+, history.state was deserialised on every read, in turn causing simple comparisons against history.state that would always return false.
Angular 1.3 also includes a fix for $location
, when $location.search()
is not returning search part of current url.
Contributor Dmitry Bolgov says:
Previously, the location's internal search object could be set by passing an object to the search() method. Subsequent changes to the passed search object would be exposed when requesting the search object, but those changes would not appear in the composed url.
Now, the object is cloned, so the result of location.search() should match the contents of location.absUrl(), provided the object returned from location.search() is not changed.
Superluminal-nudge also brings with it some breaking changes, including $resource. According to GitHUb user Caitlin Potter, what the breaking change means for users is
what this does is says "when calling toJson() (from src/Angular.js) on a Resource instance, include all enumerable own properties except for
$promise
and$resolved
. In other words, it will include user-specified properties (not$promise
$resolved
-- but will include$eq
or$gt
or whatever, for example. Previously, it wouldn't.
Reaction from the AngularJS community was positive towards the release. When Google's engineer Igor Minar announced the release on GooglePlus, calling it "the best Angular yet", the announcement itself was shared 113 times.
Elsewhere, the positive response continued. On the official Reddit announcement, AngularJS 1.3 Has Beeen Released, user asdfyui123 said
When people are like 'why angular?' just show them how easy it is to provide instant feedback in forms. It's so little code now with
ngMessages
. And then changing form fields with errors? So simple withng-class
Anticipation remains rife among the Angular community for version 2.0.
You can read about the changes planned for the release in the official article AngularJS 2.0, but it should be noted that the Google team stresses the release is still in the design and prototyping stage, and some of the plans outlined will happen differently or not at all in the final product.
There is not yet any official word on when to expect AngularJS 2.0.