2 min read

After releasing Angular 7 beta in August, the Angular team released the stable version of Angular 7 yesterday. This version comes with a DoBootstrap interface, an update to XMB placeholders, and updated dependencies: TypeScript 3.1 and RxJS 6.3.

Let’s see what features this version brings in:

The DoBootstrap interface

Earlier, there was an interface available for each lifecycle hook but ngDoBootstrap was missing the corresponding interface. This release comes with the new lifecycle hook interface DoBootstrap.

Here’s an example using DoBootstrap:

class AppModule implements DoBootstrap {
 ngDoBootstrap(appRef: ApplicationRef) {
   appRef.bootstrap(AppComponent);
 }
}

An “original” placeholder value on extracted XMB

XMB placeholders (<ph>) are now updated to include the original value on top of an example. By definition, placeholders have one example tag (<ex>) and a text node. The text node will be used as the original value from the placeholder, while the example will represent a dummy value.

For example:

XMB example

compiler-cli

An option is added to extend angularCompilerOptions in tsconfig. Currently, only TypeScript supports merging and extending of compilerOptions. This update will allow extending and inheriting angularCompilerOptions from multiple files.

A new parameter for CanLoad interface

In addition to Route, an UrlSegment[] is passed to implementations of CanLoad as a second parameter. It will contain the array of path elements the user tried to navigate to before canLoad is evaluated.

This will help users to store the initial URL segments and refer to them later, for example, to go back to the original URL after authentication via router.navigate(urlSegments). Existing code still works as before because the second function parameter is not mandatory.

Dependency updates

The following dependencies are upgraded to their latest:

  • angular/core now depends on TypeScript 3.1 and RxJS 6.3
  • @angular/platform-server now depends on Domino 2.1

Bug fixes

Along with these added features, Angular 7 comes with many bug fixes, some of which are:

  • Mappings are added for ngfactory and ngsummary to their module names in aot summary resolver.
  • fileNameToModuleName lookups are now cached to save expensive reparsing of the file when not run as Bazel worker.
  • It is allowed to privately import compile_strategy.
  • Earlier, when an attempt was made to bootstrap a component that includes a router config using AOT Summaries, the test used to fails. This is fixed in this release.
  • The compiler is updated to flatten nested template fns and to generate new slot allocations.

To read the full list of changes, check out Angular’s GitHub repository.

Read Next

Angular 7 beta.0 is here!

Why switch to Angular for web development – Interview with Minko Gechev

ng-conf 2018 highlights, the popular angular conference