“Any sufficiently advanced technology is equivalent to magic.” – Arthur C. Clarke
The last version of AngularJS—AngularJS 1.7—is finally out. Now it’s either AngularJS 1.7 for you or one of the Angular versions (a TypeScript version, that is).
The Angular team sitting at Google has certainly stopped advancing AngularJS after AngularJS 1.7. But that’s not something to mull over. Since, per their plans, they have now begun with Long Term Support for AngularJS 1.7.x.
And yes, that means you can relax for yet another three years, even if you haven’t migrated from AngularJS to Angular.
Of course, the Long Term Support has surfaced with some exclusive bug fixes and performance improvements. AngularJS has a few new features to its core and external modules. Some of the long-deprecated modules and APIs have been removed.
Let’s look at some of the major changes introduced for the last time:
- $resource has been introduced with support for request and requestError interceptors
- Deprecated features have been removed:
1) the $controllerProvider.allowGlobals() flag
2) the $compileProvider.preAssignBindingsEnabled() flag
3) the angular.lowercase and angular.uppercase methods
4) the $cookieStore service from the ngCookies module
5) the ngClick override directive and corresponding services from the ngTouch module
6) the complete ngScenario module
Now, let’s look at some of the breaking changes in detail:
Due to (c2b8fa), the arguments of $watchGroup callbacks have changed.
Earlier, using $watchGroup meant representing the most recent change of each entry with the entries in newValues and oldValues.
However, now the oldValues entries will be equivalent to the newValues of the listener’s previous call. Therefore, the comparison between the newValues and oldValues entries can help determine the change in any individual expressions.
For example: $scope.$watchGroup([‘a’, ‘b’], fn) would previously:
Now the oldValue will always equal the previous newValue:
Earlier, $timeout.cancel() did nothing. But, due to 336525, it will now throw an error if called with a promise that was not generated by $timeout().
Earlier, the tpload error namespace was $compile. Now, due to c617d6, the tpload error namespace has changed. A code matching errors of the form [$compile:tpload] will not run anymore. It should be changed to match [$templateRequest:tpload].
Also, previously, $templateRequest() returned the response content directly. However, due to fb0099, it now returns the response of $templateCache.put() when a server request is made for a template.
What it means is that if you try to manipulate the template by decorating $templateCache.put() and retrieve the template from the cache, the result will not only show on subsequent calls, but also on the first $templateRequest() call.
Since, rarely any app depends on the template (which will be different on the first and subsequent calls), none of your apps will be affected.
What happened earlier was $animate.cancel(runner) used to resolve any underlying promise and calls as if there was a successful ending to the animation. Now, due to 16b82c, $animate.cancel(runner) rejects the underlying promise and calls the catch() handler on the runner returned by $animate functions (enter, leave, move, addClass, removeClass, setClass, animate).
The Upgrade is Easy. Let’s Talk.
Popular Blog Posts
Got a Query? Ask Away!
Thanks for reaching out to us. We will get in touch with you shortly.