AngularJS 4: What’s new and What to look forward?
As promised earlier, angular has adopted semantic versioning in the form of Angular 4, rolling out some interesting features and functionalities. With Angular 2 released not long ago, the team is back with their next big update as scheduled. They’ve bumped everything into 4.0 instead of 3.0 mainly to sync different modules.
Wasting no time, let’s dive in to know what this new version of Angular has in it.
What does this update provide best?
The biggest and perhaps the most significant of changes imparted in this update is the AOT (Ahead of time compilation) powered view engine. It’s very subtle though, and will not be easy to notice early on.
What they have worked on here is, effecting a view engine simply by coupling the advantages of AOT. Among the several advantages, the reduction in code size is considered very applicable. And most importantly, it’s achieved by retaining the same performance.
This is one another refinement done as a part of Angular’s universal project. Before, the project was handled and maintained by community support alone. But, now, following this release it’s all set to be taken over officially and will be included under the official Angular project.
Up until now, the functions required for animations were presented inclusive of @angular/core which meant that these codes will be occupying the applications always, even if they aren’t used.
Now, to offer a pragmatic solution, they’ve pulled animations out of @angular/core by providing a separate package. So, from now on, if you wish not to use animations, additional codes won’t be there in production bundles.
Hereafter, the ng-template tag should be used instead of the template tag as it has been deprecated and marked as unacceptable. Also, it’s now possible to use else syntax in templates. To simplify the let syntax, the keyword as is added to the template syntax. What it does is, allows you to store a result in a variable present in the template and also to use it in the element. If you encounter an error, root cause being something, there a source map will be generated that gives an indication with respect to the original template.
This update makes Angular compatible with the latest version of Typescript like 2.1 and 2.2. This can boost the speed of ngc guaranteeing better type checking just about everywhere in your application.
To augment the browser’s compilation and execution performance, flat version of modules is introduced. What does this mean? It’s quite simple, only one file is shipped per module which contains almost everything present in that module. This may well improve tree-shaking thereby minimizing the overall size of generated bundles.
With this update, the entire code is packed with closure annotations to let Angularjs developers experience the advantage of latest closure optimizations. Ultimately, this again ensures better tree-shaking and minimal bundle sizes.
Primarily, this release is aimed at making Angular smaller and faster. It has to be said that the migration promises to be a trouble-free one. Angularjs development companies will definitely be delighted with this adjustment that abridges complication.