How To Update Angular

July 2, 2022 • • Published By • 2 minute read

Angular is continuously improving. Staying up-to-date with Angular makes sure you take advantage of new features, as well as optimizations and bug fixes. Let’s learn how to update Angular!

Table of Contents

Your Current Angular Version

Before updating Angular, let’s figure out what version of Angular you’re currently using. The first option is to look at your package.json file, specifically the @angular/core and @angular/cli packages. Packages use Semantic Versioning, which represents versions as MAJOR.MINOR.PATCH. We’re interested in the first number, the major version number. In the below example, you can see I’m currently using version 12.

  "dependencies": {
    ...
    "@angular/core": "~12.2.11",
    ...
  },
  "devDependencies": {
    ...
    "@angular/cli": "~12.2.11",
    ...
  }

The other option is to use the Angular CLI. It provides a command called version. Make sure you’re in your project’s folder and run either of the following at the command line:

ng version
ng v

It will output something like the following:

Angular CLI: 12.2.11
Angular: 12.2.11

Now that we know what version of Angular we’re currently using, we can update to the next version!

Angular Update Guide

Angular provides a helpful update guide! You select the version you’re currently on and the version you want to update to. It is not recommended to jump multiple versions at once when updating. It’s better to migrate to each one individually. For example, I shouldn’t update from 12 to 14. I should update from 12 to 13 and then 13 to 14.

The update guide provides helpful information before, during, and after the update. Carefully read through the information.

Update Angular

If you’re updating to the most current release, you can run the following command:

ng update @angular/core @angular/cli

If you’re updating to a specific version, add it at the end of the package name. For example, if I want to update to version 13, I would run the following command:

ng update @angular/core@13 @angular/cli@13

You can also just run ng update without any additional commands and it will list updates available with recommended steps.

Notifications of New Releases

If you would like to be notified of new releases, you can follow Angular on Twitter or subscribe to the Angular blog.

Related Articles
About the Author

Front End Developer

https://nightwolf.dev