A brand-new Angular is right in the center of most people’s radar as of late. The K&C team didn’t miss the opportunity to give its feedback on the fifth so-called ‘pentagonal-donut’ version of Angular. We’ve selected the most essential changes and suggest you get acquainted with them to stay abreast of the last IT events.
The Backbone of Angular 5.0.0: Its goal is to facilitate the creation of progressive web applications so as to be able to cache apps in the browser and support them easier. The current concept is the product of joint efforts from Google and Mozilla, and implies app development on a browser basis.
“Easier, smaller, faster is the theme for version 5. We’ll continue that theme for version 6, just making [developers’] lives easier, making it possible to deliver apps better for their users,” said Brad Green, a Google engineering director.
So let`s look at what a new Angular can offer!
- Angular CLI 1.5 now includes Angular version 5.0.0
- Typescript was updated to version 2.4
- RXJS was updated to version 5.5
CLI 1.5 will produce v5 projects with the included build optimizer thus making bundles smaller. The two primary functions of this build optimizer are to do away with unneeded parts of the application by marking them ‘pure’. And the second purpose is to get rid of Angular decorators from the app’s runtime code.
Previously, the Angular compiler (ngs) recompiled all files at every change, which greatly slowed down the development process. In the new version, an upgraded watch option was presented. It recompiles only those files that you need at the moment. Thus, the compilation time for average projects has reduced from 12-14 to 2-3 seconds. This saves you time, which is valued a lot during the working process.
AOT On By Default
One more pleasant bonus is the ability to work in two modes; however, the second one is preferable.
- JIT (just-in-time) – Component templates are compiled at runtime
- AOT (ahead-of-time) – Component templates are compiled beforehand (Ahead of time, AOT)
With the launch of CLI 1.5, there will be no need to think about the mode to build your app in. From now on, you can safely choose AOT.
Since the release of Angular 4.3, a new HttpClient has appeared. Starting with Angular 6, the old client will be deleted; in the current Angular, it is marked as ‘deprecated’.
Angular Form Validation
Today, developers on their own can define only those fields that are important for them from an efficiency point of view. With this, now the validation and updating of values in forms can be applied only to ‘blur’ or ‘submit’, not to all input events.
Changes with Pipes
The Angular developers updated number, date, and currency pipes, having eliminated the necessity to implement i18n polyfills. Therefore, it is possible to specify the localization as the last parameter.
New Router Lifecycle Events
From now on, it will be possible to track the full life cycle of the router. This appears to be instrumental when estimating the performance of guards and/or resolvers.
New events (successively):
Angular Universal Transfer API
Angular Universal is created to help developers perform server-side rendering (SSR) in Angular applications, as far as it is much easier for search engines to find a particular piece of content if your app is rendered on the server and then loaded into HTML. This affects performance dramatically.
- Bug fixes
- Preserve Whitespace Option (now you can choose to save it or not)
- ExportAs (for adding multiple names to your components in your directive)
- Zone speed improvements
The latest Angular seems to have lots of breaking changes; nevertheless, they all pale in comparison to the switch from Angular.js to Angular 2. With this in mind, the Angular team backed us up by providing a specialized resource, the Angular Update Guide, which will make life much easier.
The K&C team has already tried the latest version of the Angular and is ready to use its knowledge to work successfully on new fascinating projects.