Updating my project to latest Angular Version (Angular 10)

Hello everyone, this article is to help you upgrade your product/website using angular to the latest version. I have upgraded my large project from Angular 8 to Angular 10

If you are upgrading to an older version, as recommended by Angular to upgrade to the next major version first instead of moving directly to the latest version (like current latest version is v10 and you are upgrading from v8, its recommended to first upgrade to v9 and then to v10), then you have to provide the update the dependencies/package to the latest version compatible with Angular9.

For upgrading, first check the required dependencies to be updated with the help of

ng update - which will list all the dependencies you have to update(see image)

Referring to the picture, there are 6 packages to update which we will update to the version we are upgrading to(in this case it is v9) using ng update command:

ng update @angular/cdk@9 @angular/cli@9 @angular/core@9 @angular/material@9 @ngx-pwa/local-storage@9 rxjs --force

(you can define specific versions of the packages by going to npm packages, for example — @angular/core@9.1.2 as 9.1.2 is the latest stable release of @angular/core package for angular9).

This will update your project to angular v9.

Similarly, for v10, you need to follow the above process.

[Note: For the latest angular version(which is v10 at the time of writing this), you need not provide the version during update and you can directly update as:

ng update @angular/cdk @angular/cli --force

You can also use npm outdated to view the outdated packages which needs to be updated.

This will update your project with the latest Angular Version.