A bit on Angular if you’ve been living under a rock
The first ever version of angular was introduced in 2010 with the idea of building a single page application with model-view-control capabilities. And with the time AngularJS became a viable platform to build single page applications among the developers.
Even so everything was going so well with AngularJS, google decided to introduce a new version which was named Angular2.
AngularJS was aimed to separate the application’s logic from the DOM manipulation. But even so with lots of optimization, angular JS struggles with performance issues. Also with the technologies emerging like React providing support for mobile and component based structure, AngularJS started lacking in these areas.
Hence Angular 2 was released in 2016. Angular2 is developed to be fast and mobile oriented with component-based approach and it is a complete rewrite of AngularJS.
Since the release of angular 2, angular has released constant updates from time to time. The current version of angular in the market is angular9. Let’s discuss the new features of angular introduced in version 9.
New in Angular 9
According to the Angular team it is the largest release of angular from past three years and IVY is the most exciting and awaited feature of angular9. Performance has always been the main concern of angular team and the outcome of their efforts of making code light and fast is IVY. It is the new default compiler of angular.
IVY removes all the unnecessary and unused code from the application using tree shaking procedure and reduces the bundle size. Smaller bundle size results in better performance.
Angular applications that use Angular material can benefit most from this feature in unit testing. Writing the test cases for the material component has been effortful as the classes of material component changes with DOM manipulation.
Component harness is a part of Angular CDK version 9, it comes up with an API which can be used to fetch component attributes. It hides the component implementation and provides the control over related components and child components.
AOT compilation is not a new feature of angular but it has something new to contribute. Prior to angular 9 the AOT compilation ran only on prod builds, which means the error which is going to occur in prod build will never be visible in dev builds (ng serve). Because of this developer can have so many issue at the end of the day when they have to deploy the code into the server.
Well here is the good news for developers, now that IVY compiler has made build so much faster, Angular team brought the AOT compilation to the dev builds. So now the errors which used to come out of nowhere in prod-build will be better handled in development mode.
Angular has introduced new ways to debug your code in development mode with the help of new ng Object. Now you can inspect the element, take the instance of your component and using the instance you can call the methods and change the value. And once you are done with changes you can apply those changes by triggering angular change detection cycle. It saves so much time used in debugging by the developers.
Performance enhancement has been made in unit testing. As per the Angular team the test cases are 40% faster than before with the new TestBed. In previous versions components were recompiled for each test case in “it” method, now from angular 9 compiled modules are cached. It gives the major improvement to testing performance.
Now that Angular 9 is here there is no need to add entry components in the module as the changes have been made to the compiler. Angular will identify the component by itself.
Yet the components you have already declared in your application will not be removed automatically with ng-update, you have to remove them from your code manually.
Angular 9 has made changes in the ng-update. Now while updating the version angular will use the CLI of destined version. A new flag –create-commit has been introduced, when you run ng-update –create-commits, it commits the code state after each migration.
Angular has introduced two new component youtube-player and google-maps. Now you can integrate google maps and youtube in your application in an improved manner.
Angular 9 is indeed the biggest release of Angular. Angular 9 is going to be a good experience for developers as Ivy has made Angular much faster and better than its previous versions.