When you are working on an Angular project, it is important to know the version of Angular used by the project.
If the project is built on some older version, it is always recommended to update it to the latest version of Angular for several reasons such as compatibility, security, bug fixes, and of course to use new features of Angular.
But how do you check the Angular version of a project?
Well, there are two ways to check the Angular version of a project.
- Using the Angular CLI
- Using the package.json file
Let’s discuss both methods in detail.
1. Check the Angular Version using Angular CLI
To check the Angular version of an Angular project you can use Angular CLI(Command line interface).
Open the terminal or command prompt and navigate to the root directory of your angular project and run the following command:
This will display information about the Angular CLI and the versions of Angular packages used in your project.
You can see from the above image that the Angular version 16.2.2 is used on the project.
It also shows the version of a bunch of other important packages used by the project.
2. Check Angular Version using package.json File
You can also check the version of Angular on a project using the package.json file.
The package.json file can be found in the root directory of your project. It contains the essential metadata about your project, including its dependencies, scripts, version information, and more.
To check the Angular version of the project, you can look for the dependencies section in the package.json file and check versions of different packages including Angular.
The main Angular package is named @angular/core and the version of this package specifies the version of Angular used by your project.
As you can see from the above image, Angular version 16.2.0 is used in our Angular project.
You can use either of two methods to check the version of Angular used by your project. But I recommend using the second approach as it also shows the versions of other packages used by your project.
That’s all for this article. Thanks for reading!