THE BLOGS

Angular

Angular 5 is out? How is it different from angular 4?

Just in March 2017, when we had the Angular 4 instead of the 3, it meant to be a  major update for the AngularJS framework. However, by the year end, we have another Major Release the Angular 5. Now, a lot of developers are in a state trying to understand what are the differences, and is it the good time to migrate to angular 5?

Stephen Fluin,’Developer Advocate’ at Google explained in his blog post announced Angular 5 and mentioned briefly about Angular 5 version 5.0.0. Production builds of Google created with the Command Line Interface which is commonly abbreviated as CLI will now apply the build optimizer by default. A build optimizer is a tool which is included in their CLI for making users’ bundles smaller using the team’s semantic understanding. Here we are going to give you some optimal specs of Angular 5 which are much much better or unique than the Angular 4 –

Build Optimizer –

According to the makers of Angular 5 the latest version of Angular 5.0.0, production builds which created with the CLI will now apply the build optimizer by its default. A build optimizer is a tool which is included in CLI for making your packets smaller using a basic understanding of your Angular application.

There are two main functions of the build optimizer. The first one is to be able to mark parts of your application as pure which improves the tree shaking.

Tree shaking refers to removing unused modules (dead-code elimination) when bundling the app.

The second main function of the build optimizer is to remove Angular decorators from your application’s runtime code. Decorators are usually used by the compiler, and aren’t needed at runtime and can be removed. Here both the actions decrease the size of your JavaScript bundles and increase the boot speed of your application for your users as well.

The build optimizer has been turned on by default, so developers can now benefit from smaller bundles.

Angular Universal State Transfer API and DOM Support –

Angular Universal focuses on helping developers to perform server-side rendering which is usually abbreviated as SSR for Angular applications. After rendering your Angular applications on the server and then bootstrapping on top of the generated HTML, you can add support for scrapers and crawlers that don’t support JavaScript and increase the perceived performance of your application.

More Faster and Smaller –

As compared to the Angular 4, Angular 5 is faster and smaller.

Some Additional Features –

This is a major release which contains new features and bugfixes. After the release of this version, it is continuously focussing on making Angular smaller, faster, and easier to use. In 5.0.0, the team has added ServerTransferStateModule and the corresponding BrowserTransferStateModule. This module allows you to generate information as part of your rendering with platform-server, and then transfer it to the client side so that this information does not need to be regenerated. This is useful for cases such as when your application fetches data over HTTP.

The new HTTP module is based on RxJS Observable, which makes it easier to write code that ‘retries’ the HTTP call. Angular 5 team added more useful pipes like ‘async’ which automatically subscribes and unsubscribes an Observable.

In the Angular 5, Service Worker is built into the framework. It reduces the gap between a classic web application and native application and makes the web application downloadable and installable, just like a native mobile application.

Compiler Improvements –

According to the team of Angular, in this version of Angular, they have changed the Angular compiler to support some additional higher collection. Due to which it provides rebuilds which are faster and this production is built by performing with AOT especially. It also added features to our Decorators and made it possible to ship smaller bundles by removing whitespace.

TypeScript Transforms –

In the new version of Angular 5, the Angular compiler now operates as a TypeScript transform. The angular transformer extends the typescript compiler with some extra rules, so it knows how to parse the angular specific things that are needed. TypeScript transforms were a new feature offered as part of TypeScript version 2.3.

Some other Specs –

Angular 5 has some other unique feature from the other Angular versions. In future, it will become the default in a future release of the CLI. There is some known speed related concerns with projects with more than a thousand components. The angular team is hoping that it wants to be sure projects of all sizes will experience these improvements.

So, that was our take regarding the Angular 5 release. If we have missed out something, ensure you share it in your comments section. And if you are looking for support on Angular 5, talk to us on info@pacewisdom.com our development team should be happy to help you out.

Posted By :Pace Wisdom