It is about time to take on the Angular 8 upgrade. In this post we will see the steps that I needed for this job. In an earlier post we made the Angular 7 upgrade and there are a lot of similarities. Let’s dive into it!

Please take a look at what the Angular team has to say on versioning here.

Angular CLI

We already saw from the previous upgrade that we could use the Angular CLI to do the dirty work for us by using:

ng update @angular/cli @angular/core

A shortcoming that we did not discuss then is that the command could not handle local dependencies (dependencies on your own libraries). This time it works fine if you upgrade to the latest version of the Angular CLI first.

npm update -g @angular/cli

Note that Angular 8 supports Typescript 3.4 and we need Node LTS 10.16 or above. Upgrade these too.

Viewchild

There is a breaking change in how to use Viewchild and ContentChild. In Angular 8 we have to provide a mandatory boolean static, that indicates when in the component lifecycle the element is to be found. If static = true Angular tries to find the element during the initialisation of the component, otherwise after initialisation.

@ViewChild('nameForm', {static: true}) public form!: NgForm;

Other libraries

Other libraries that I upgraded during this process included:

  • codelyzer (5.0 support)
  • rxjs
  • ng-packagr
  • tsickle
  • tslib

Hopefully you had a taste of what the Angular 8 upgrade could bring and what steps you have to take yourself to keep up. Happy upgrading!