Google has just released a new version of Angular; i.e. 6.0 in mid-April 2018. It was the first major release from Google in 2018 and mainly focused on the toolchain and also making Angular easier for the user to create different types of applications. This major version also contains some new features and upgrades with respect to the previous versions. At the final stage, this release confirms that the new Angular version is much lighter, faster and easier. Developers will obviously prefer it as it makes their development more easy. Also, Angular 6 support the Typescript version 2.7. So with the help of the new Typescript version, it is very easy to code with conditional type declarations, default declarations and strict class initialization.
Now it’s time to discuss the major changes made in Angular 6.
Angular Elements
Since Angular is a perfect framework for developing Single Page Applications, to create a widget or component that can be included in any existing web page was not a simple task. But in Angular 6, it can be done with the help of Angular Elements. Actually, Angular 6 is the first release which completely supports Angular Elements. Angular Elements is the brainchild of Angular’s Rob Wormald. The Angular Elements package will give us the ability to create an Angular component and then publish that component as a Web Components which can be used in any HTML page (maybe that page is not using Angular Framework) in other environments. It actually takes an Angular component and then wraps it within a custom element as a DOM element so that we can use our favorite Angular component in other projects which do not have any support of Angular Framework.
Service Worker Support
Service worker is basically a script which runs in the web browser and manages to cache an application. This Service Worker was first introduced in Angular 5. In Angular 6, service worker comes with some bug fixing including some new functionalities. So when we deploy the latest version of the application, sometimes we may need to deactivate or uninstall the existing service worker. In Angular 5, there is no such straightforward option for doing this or deactivating service worker. But Angular 6 brings this functionality with the new script file named safety-worker.js which is actually a part of the production bundle which is helps us to unregister the existing service worker.
Angular 6 now supports the configuration of navigation URLs within the Service Workers. The service worker will redirect navigation requests that don’t match any source or data group to the specified index file. Now, we can mention an optional navigation Url's list in ngsw-config.json files which contain the desired URLs. Only requests whose URLs match any of the positive patterns and none of the negative ones will be considered as navigation requests and handled the right way by the Service Worker. In Angular 6, the service worker remains in the current mode unless the server is reconnected and updates the work.
Bye Bye Template Element
The <template> element was depreciated one year ago when Angular 4 was launched. Now it’s time to say goodbye to the <template> because it is now removed from the Angular 6 framework. In spite of using <template>, we need to use <ng-tempalate>
i18n
One of the major changes in Angular 6 is in localization or i18n. In Angular 6, i18n is coming with runtime rendering so that there is no requirement to build applications once per locale. The currency pipe was improved in Angular 6 such that it makes a lot of sense, like it will not round every currency value with 2 digits anymore. It will then round the currency to the appropriate digits (like it can be 3 digit roundup for Arabic Dinar or 0 roundups for Chilean Pesos). If we want to retrieve this values programmatically, then we need to use the i18n function getNumberOfCurrencyDigits(). There are some other formatting functions which are also exposed publicly like formatDate, formatCurrency, formatPercent and formatNumber.
Ivy : New Rendering Engine
In Angular 6, the Angular team introduced their third rendering engine called IVY. Ivy is the next generation Angular rendering engine. In the previous versions of Angular (i.e. Angular 2 to Angular 4), Angular used View Engine for rendering purposes. Introduction of this rendering engine means an increase in speed and decrease in the application size. Angular team expects the same type of experience with the new rendering engine.
Angular compiles our templates into equivalent TypeScript Code and then the code is compiled along with the TypeScript to Javascript code and then the result is shipped to users. So Ivy renderer is the new rendering engine which is basically designed to support backward compatibility with existing rendering and then also focused on improving the speed of rendering and optimizing the size of the final package. In Angular, it will not be the default renderer but we can manually enable it using compiler options. This important feature is not completely released in Angular 6 since it is in experimental mode and the complete version will come in the next release.
ngModelChange
Before, Angular 6 ngModelChange event was emitted before the said form control update. If we have an event handler for the ngModelChange event that checked the value through the control, the old value will be returned instead of the changed value. Now in Angular 6, ngModelChange has omitted the value after the value is updated in the form control.
ElementRef<T>
In previous versions of Angular, when we want to create the reference of an element in the template, we can use @ViewChild or @ViewChildren or inject the host using ElementRef directly. But, the problem is that ElementRef had its nativeElement property typed as any. But now in Angular 6, we can use type ElementRef more strictly if we want.


Bhairab DuttPosted Jun 7, 2018, 1:05 PM
Nice Article ....
Naresh SinghalPosted Jun 7, 2018, 3:12 AM
Nice and informative article ....Keep on it ...Sir Debasis Saha