A late 2017 study by Stack Overflow, not so surprisingly, found Angular as the technology with the most dramatic increase the previous year. Angular is a popular open source front-end web and mobile application framework developed by Google. 2017 has indeed been a great year for Angular, with two major releases – Angular 4 and Angular 5.
Angular 5, the pentagonal-donut, was released with new features and bug fixes. The end goal is to make Angular smaller, faster and easier to use. Progressive web apps have been made easier with added Material Design compatibilities.
Many big companies like Google, Upwork, Freelancer, YouTube, Paypal, Udemy, Nike, AWS, and Crunchbase are using Angular 5. The framework is spectacular as it comes with several advanced features over earlier versions. Let’s take a look at what’s different:
#1 Build Optimizer
Angular 5 is available with a build optimizer, which eliminates the need for unnecessary code, making the application faster and lighter. From now on, any production build developed with Angular CLI will by default use the build optimizer. It helps remove the decorators from runtime codes and decrease the bundle size.
Build optimizer performs tree-shaking to remove the application part, which is not required during runtime. This makes the application boot faster and reduce in size.
#2 Angular Universal API and DOM Support
Angular Universal is one of the best features introduced in Angular 5, which helps perform server-side rendering of Angular applications. This project by Google makes it easier for developers to share the application state or code between client- and server-side versions.
Domino added to platform-server implies DOM manipulations can now occur out of the box within the server-side contexts.
In addition, two modules have also been added to Angular Universal—ServerTransferStateModule and BrowserTransferModule. Using these, you can generate information as part of rendering within the platform-server and transfer it to the client, which removes the need to make an HTTP request a second time.
#3 New HttpClient
The HttpClient feature was first introduced in Angular 4. In Angular 5, this feature comes with advanced functionalities. Now you can deprecate the old library by replacing HttpModule with HttpClient Module in each module. Utilize the newly added features such as JSON body type support, interceptors, and progress events.
JSON body types allow for typed, synchronous response body access, and do not need to be explicitly analyzed anymore. With interceptors, you can insert middleware logic into the pipeline. The new HttpClient also features immutable request/response objects, and performs request uploading and response downloading with progress events.
#4 Incremental Compilation
To run the AOT (Ahead-of-Time) compiler, all you need to do is use the ng serve command and –aot flag together. In the future, this may be introduced as a default feature.
Due to AOT, the current compiler ensures faster and lighter applications with lesser asynchronous requests and early template error detection.
#5 Internationalized Number, Date, and Currency Pipes
Angular 5 ensures improved standardization across browsers with internationalized new number, date, and currency pipes. You do not need i18n polyfills anymore.
Unlike the previous versions where you had to depend upon browser API for number, date, and currency formatting, which provided inconsistent results across browsers, the new pipes are CDLR-supported. These help you support any locales of your choice with extensive locale support and configurations.
Note: To continue using the existing pipes, you need to import DeprecatedI18NPipesModule after the CommonModule.
#6 Multiple Export Alias
When exporting, developers can give multiple names to components and directives in the latest Angular release. This helps users migrate without breaking code changes made internally.
#7 New Lifecycle Events Router
The router has new lifecycle events, including ChildActivationStart, GuardsCheckStart, GuardsCheckEnd, ActivationStart, ResolveStart, ResolveEnd, ChildActivationEnd, and ActivationEnd. What can you expect as a developer? You can track the router cycle since the beginning of running guards to the end of activation.
Configuration of the router has become easier, which helps reload a page on receiving a navigation request to the same URL.
#8 Forms Validation
Now forms can decide when a field’s or form’s value or validity is updated using on blur or on submit. Angular Form Validations has improved features related to functionality and syntax, which ensure improved UI performance.
How to Upgrade from an Outdated Version to Angular 5
We recommend switching to Angular 5 if you want to accelerate your development process and increase your conversion rate. Read our next blogpost here that contains some quick steps to migrating from AngularJS to Angular 5. We have compiled all information you need before you update to the current version.
Meanwhile, the grand Angular 6 finale is here already! Click here to see how it is the best of all Angular versions.