Angular 8 Features

Angular 8 is the latest version released by the Angular community to include some prominent changes and improvements. One of which includes the Ivy compiler as an opt-in feature.

Angular 8 most prominent features:

  • Support TypeScript 3.4
  • Supports Web Workers
  • Preview of Ivy available
  • Lazy loading
  • Improvement of ngUpgrade

TypeScript 3.4:

TypeScript 3.4 is supported by Angular 8 which is required to run an Angular 8 project. A new flag is introduced by TypeScript 3.4 which is named as –incremental, that instructs TypeScript to save information about the project graph from the last compilation. When TypeScript is invoked with –incremental, the information is used by Typescript to detect the least costly way to type-check and emit changes to a project.

Web workers class:

Being single-threaded, JavaScript is popular for extra demanding tasks like data calls to take place asynchronously. Freeing the main thread to update the user interface, by running the CPU intensive computations in the background thread, can be done using the Web Workers class. In case an application is unresponsive while processing data, Web workers can be a great help. It is necessary to first create the web worker using the Angular CLI in order to outsource such a calculation to a background.

Preview of Ivy and Bazel available:

The release of Angular 8 brings with it a preview version of Ivy which is presently available for testing. The new rendering engine that produces small bundle size is how the Ivy can be described. While Bazel can be described as the new build system. The preview of both the Ivy and Bazel should be available shortly as both are available for proper use with Angular 8. Among all the Angular versions released so far, Angular 8 is the first release to offer a switch to opt-in into Ivy officially, which makes Ivy a new compiler/runtime of Angular. In Angular 9, Ivy is guessed to be a default rendering engine. Bazel facilitates one of the latest features of Angular 8 as a chance to develop a CLI application more rapidly. The Angular CLI needs to be instructed to enable Ivy in an Angular 8 project using the –enable-ivy switch.

Command:

$ ng new angular-project --enable-ivy

Advantages of Bazel:

  • Incremental build and tests.
  • Facilitates an option to make the backends and frontends with the same tool.
  • It offers the possibility to have remote builds and cache on the build farm.
  • Facilitates dynamic imports for lazy-loaded modules.

Lazy Loading:

Instead of a custom string for lazy-loaded modules, Angular 8 supports the facility to use standard dynamic import syntax. The lazy-loaded import that used to be looked like below:

{ path: '/student', loadChildren: './student/student.module#StudentModule' }

will now looked like below:

{ path: '/student', loadChildren: () => import('./student/student.module').then(s => s.StudentModule) }

Improvement of ngUpgrade:

With the continuous improvement of the Angular CLI, the ng build, ng test and ng run are now equipped by 3rd-party libraries and tools. These new capabilities, for instance, are used by the AngularFire with a deploy command.