[angular] How to check the Angular version?

I installed @angular/cli package via npm, using this command:

npm install -g @angular/cli

The version 1.4.2 of @angular/cli has been successfully installed. But that is not the Angular version, but the CLI version.

After running ng new myapp how can I check which Angular version the created app is? 2.x, 4.x?

This question is related to angular angular-cli

The answer is


Angular CLI ng v does output few more thing than just the version.

If you only want the version from it the you can add pipe grep and filter for angular like:

ng v | grep 'Angular:'

OUTPUT:

Angular: #.#.# <-- VERSION

For this, I have an alias which is

alias ngv='ng v | grep 'Angular:''

Then just use ngv


Use one of these commands in the terminal (with the Angular CLI installed already):

$ ng --version 

or

$ ng v

But note that depending on the folder you are in, you will get different results.

If you are NOT in an angular project folder, then will see a result like this with no clearly stated Angular: version line, unless referring to the angular core in the package block (as the version) :)

Angular CLI: 11.0.4
Node: 14.15.1
OS: win32 x64

Angular:
...
Ivy Workspace:

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.1100.4 (cli-only)
@angular-devkit/core         11.0.4 (cli-only)
@angular-devkit/schematics   11.0.4 (cli-only)
@schematics/angular          11.0.4 (cli-only)
@schematics/update           0.1100.4 (cli-only)

And if you run the command IN an angular project folder, you will see a similar result like this with the Angular: 8.2.14 clearly stated (plus some dots).

Angular CLI: 8.3.29
Node: 14.15.1
OS: win32 x64
Angular: 8.2.14
... core

Package                             Version
-------------------------------------------------------------
@angular-devkit/architect           0.803.29
@angular-devkit/core                8.3.29
@angular-devkit/schematics          8.3.29
@angular/cli                        8.3.29
@angular/common                     2.4.10
@angular/compiler                   2.4.10
@angular/compiler-cli               2.4.10
@angular/forms                      2.4.10
@angular/http                       2.4.10
@angular/platform-browser           2.4.10
@angular/router                     3.4.10
...

In Command line we can check our installed ng version.

ng -v OR ng --version OR ng version

This will give you like this :

 _                      _                 ____ _     ___

   / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
  / ? \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
 / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
/_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
               |___/

Angular CLI: 1.6.5
Node: 8.0.0
OS: linux x64
Angular: 
...

ng v

Simply run the command above in terminal.


There are many way, you check angular version Just pent the comand prompt(for windows) and type

1. ng version
2. ng v
3. ng -v

check the angular version using comand line

4. You can pakage.json file

check the angular version on pakage.json file

5.You can check in browser by presing F12 then goto elements tab

check the angular version on your browser

Full understanding of subversion about(x.x.x) please see angular documentation angularJS and angular 2+


From angular 7 on-wards the following two commands are working

ng --version 
ng version

run ng version

then simply check the version of angular core package.

@angular/cli: 1.2.6
node: 8.11.1
os: win32 x64
@angular/animations: 4.3.2
@angular/common: 4.3.2
@angular/compiler: 4.3.2
**@angular/core: 4.3.2**
@angular/forms: 4.3.2

For Angular 1 or 2 (but not for Angular 4+):

You can also open the console and go to the element tab on the developer tools of whatever browser you use.

Or

Type angular.version to access the Javascript object that holds angular version.

For Angular 4+ There is are the number of ways as listed below :

Write below code in the command prompt/or in the terminal in the VS Code. (up to 3)

  1. ng version or ng --version (Find the image for the reference)
  2. ng v
  3. ng -v

In the terminal you can find the angular version as shown in the attached image : enter image description here

  1. You can also open the console and go to the element tab on the developer tools of whatever browser you use. As displayed in the below image :

enter image description here

  1. Find the package.json file, You will find all the installed dependencies and their version.

check the Command Prompt

ng --version OR ng version OR ng -v


ng --version

you can watch this vidio to install the latest angular version. https://youtu.be/zqHqMAWqpD8


ng --version command returns the details of the version of Angular CLI installed


my 2 cents, in Angular 9 (didn't check older versions) you can find angular version in root div attributes and this is how I show current version in app-root component (extract and save it in my Global's for use in other components:

import { Component, ElementRef } from "@angular/core";
....
@Component({
  selector: 'app-root',
  templateUrl: `<div>
    <h1>TestApp: .NetCore3.1 + PostgreSql 12 + Angular {{ngVersion}}</h1>
</div>
....
 `
})
export class AppComponent {
  ngVersion: string;
  constructor(private router: Router, private el: ElementRef) {
    ....    
    //read ng-verion and save it in Global's
    Global.ngVersion = this.el.nativeElement.getAttribute("ng-version");
    this.ngVersion = Global.ngVersion.substring(0, 1);
    ....
  }
}

  1. ng v
  2. ng --v

you shall see something like the following:

Angular CLI: 7.3.8
Node: 10.15.1
OS: win32 x64
Angular: 5.2.10
... animations, common, compiler, core, forms, http
... platform-browser, platform-browser-dynamic, router

Angular version is in line 4 above


In the terminal type in either ng -v or ng --version.


First install the Angular/cli globally in machine. to install the angular/cli run the command npm install -g @angular/cli

Above Angular7 , use these two commands enter image description hereto know the version of Angular/Cli 1. ng --version, 2.ng version


You should check package.json file in the project. There you will see all packages installed and versions of those packages.


I think the answer given by D. Squire was accurate, but possibly only a tad vague. If you change directories to a project and then type ng --version, it will display the angular version in the project. If done from a default directory (not within a project), you will only get the Angular CLI version, which is probably not what you are looking for and will give the output shown by Vik2696.

$ cd my-project
$ ng --version   // done within project directory

Angular CLI: 1.6.8
Node: 8.9.4
OS: win32 x64
Angular: 5.2.5
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cli: 1.6.8
@angular-devkit/build-optimizer: 0.0.42
@angular-devkit/core: 0.0.29
@angular-devkit/schematics: 0.0.52
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.8
@schematics/angular: 0.1.17
typescript: 2.5.3
webpack: 3.10.0

Examples related to angular

error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class error TS1086: An accessor cannot be declared in an ambient context in Angular 9 TS1086: An accessor cannot be declared in ambient context @angular/material/index.d.ts' is not a module Why powershell does not run Angular commands? error: This is probably not a problem with npm. There is likely additional logging output above Angular @ViewChild() error: Expected 2 arguments, but got 1 Schema validation failed with the following errors: Data path ".builders['app-shell']" should have required property 'class' Access blocked by CORS policy: Response to preflight request doesn't pass access control check origin 'http://localhost:4200' has been blocked by CORS policy in Angular7

Examples related to angular-cli

Why powershell does not run Angular commands? ERROR in The Angular Compiler requires TypeScript >=3.1.1 and <3.2.0 but 3.2.1 was found instead Angular CLI Error: The serve command requires to be run in an Angular project, but a project definition could not be found Could not find module "@angular-devkit/build-angular" How to remove package using Angular CLI? How to set environment via `ng serve` in Angular 6 Error: Local workspace file ('angular.json') could not be found How do I deal with installing peer dependencies in Angular CLI? How to iterate using ngFor loop Map containing key as string and values as map iteration how to format date in Component of angular 5