How can I check which version of Angular I'm using?
Asked Answered
D

30

346

How can I tell which version of Angular I am using?

I have tried:

angular --version
angular --v
angular -version
angular -v

but get -bash: angular: command not found

I know by yeoman --version that I am using 0.9.6

But how do get the angularjs version?

Drugge answered 15/4, 2013 at 14:26 Comment(2)
Leo's answer (look at angular related lines in package.json) works for any version of AngularJS (1) or Angular 2+. Tony dong's answer (inspect application tag in DOM) works fine for any version of Angular 2 or greater. Loliski's one works only for 1 and 2, not for greater versions. The accepted answer (TheHippo) works only for AngularJS (1)Macey
Does it make any sense having the question tagged angular and angularjs? They are both completely different libraries. It would make much more sense to have one question for each. Then the accepted answer would not have been partially invalidated when the new tag was added.Maximin
M
225

Edit: When this answer was written, there was only AngularJS 1.x. Look in the answers below for Angular versions >= 2.

AngularJS does not have a command line tool.

You can get the version number from the JavaScript file itself.

Header of the current angular.js:

/**
 * @license AngularJS v1.0.6
 * (c) 2010-2012 Google, Inc. http://angularjs.org
 * License: MIT
 */
Momentary answered 15/4, 2013 at 14:35 Comment(8)
You can write angular.version , which gives version of angular.Bently
@AfshinMoazami Doesn't matter. It is in the comment on top of the file. For licensing reasons you should not delete the comment.Momentary
First, when it is minified, it is not easy to search in a huge file for a license. Second, relying on license file/comment is not really a great choice since it may change by a minfier bug.Sherasherar
The risk of this answer is if there are multiple angular dependencies potentially getting pulled in and being sure which version the browser is actually loading.Jonis
You can display the first few (5 in this case) lines of the file in terminal with: head -5 angular.js to give you just the head section of the fileSonar
What is the location of angular.js file?Antoinetteanton
@NishchitDhanani Yes, that's the best approach. It can be run in the developer tools of the browser. This means you can find out the Angular version for a website you're visiting.Unthinking
Adding Guillaume's comment to this answer: angular.version.full holds the full version (e.g. "1.2.16") as a stringMurphy
G
320

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

you can also open the console on the developer tools of whatever browser you use and type angular.version to access the Javascript object that holds angular version.

Very useful when the script is minified with no header comment.

Gratuity answered 22/1, 2014 at 18:13 Comment(4)
angular.version.full holds the full version (e.g. "1.2.16") as a stringEstipulate
Best answer, the accepted one will be impossible if using minified versionHearne
angular.version and angular.version.full do not work in version 4 but the html 'ng-version' is visible.Indecisive
Uncaught ReferenceError: angular is not defined at <anonymous>:1:1Butcherbird
M
225

Edit: When this answer was written, there was only AngularJS 1.x. Look in the answers below for Angular versions >= 2.

AngularJS does not have a command line tool.

You can get the version number from the JavaScript file itself.

Header of the current angular.js:

/**
 * @license AngularJS v1.0.6
 * (c) 2010-2012 Google, Inc. http://angularjs.org
 * License: MIT
 */
Momentary answered 15/4, 2013 at 14:35 Comment(8)
You can write angular.version , which gives version of angular.Bently
@AfshinMoazami Doesn't matter. It is in the comment on top of the file. For licensing reasons you should not delete the comment.Momentary
First, when it is minified, it is not easy to search in a huge file for a license. Second, relying on license file/comment is not really a great choice since it may change by a minfier bug.Sherasherar
The risk of this answer is if there are multiple angular dependencies potentially getting pulled in and being sure which version the browser is actually loading.Jonis
You can display the first few (5 in this case) lines of the file in terminal with: head -5 angular.js to give you just the head section of the fileSonar
What is the location of angular.js file?Antoinetteanton
@NishchitDhanani Yes, that's the best approach. It can be run in the developer tools of the browser. This means you can find out the Angular version for a website you're visiting.Unthinking
Adding Guillaume's comment to this answer: angular.version.full holds the full version (e.g. "1.2.16") as a stringMurphy
U
193

For Angular 2+, in any modern browser having developper tools (F12) you can inspect the top level application tag.

For Internet Explorer 11 or Edge you can find information here :Angular version Number

Works for Angular 2+ Chrome browser

enter image description here

Firefox firebug

enter image description here

Ursel answered 5/1, 2017 at 22:51 Comment(3)
Im not seeing this element attribute for angular version 1.5.7Dislocate
Thank you, the angular.versionwas not working at my placeLoop
Works for angular 5 as well. In any browser capable of showing the DOM, which means all modern deskto browsers nowadays.Macey
Q
123

If you are using angular-cli, then you can check it easily by typing

ng -v

or ng v in Angular 8, in Terminal or Bash. Note: Run the command within the project directory.

You should get something like this:

angular-cli: 1.0.0-beta.24
node: 7.4.0
os: darwin x64
@angular/common: 2.4.3
@angular/compiler: 2.4.3
@angular/core: 2.4.3
@angular/forms: 2.4.3
@angular/http: 2.4.3
@angular/platform-browser: 2.4.3
@angular/platform-browser-dynamic: 2.4.3
@angular/router: 3.4.3
@angular/compiler-cli: 2.4.3
Quincentenary answered 9/2, 2017 at 9:31 Comment(4)
Ah, I was stuck on this. If I type 'ng -v' in a non-project folder it just gives the AngularCLI version only - I thought it would give all info. But typing it from withing a cli created project folder gives all the details of what Angular versions that folder is usingDost
angular --version instead in Angular 7.0.2.Landslide
Keep in mind that if you use NVM and are not seeing packages that you know you have installed, you may have installed them under a different version of Node. One option is to migrate from a prior version to your current version. See more details at github.com/creationix/….Damsel
ng v in Angular 8Byronbyrum
L
80

In the browser's developer console (press F12 to open it), you can type the following,

angular.version.full

it will give you the full version, e.g. (depending on your current version). [It actually gets the full property of angular.version object.]

"1.4.3"

So, to see the full object, if you type

angular.version

It will give you the full version object containing version information like full, major, minor and also the codeName, e.g.

Object {full: "1.4.3", major: 1, minor: 4, dot: 3, codeName: "foam-acceleration"}
Librate answered 24/7, 2015 at 7:39 Comment(1)
With this command you can find out the Angular version for any website you're visiting, as long as it uses the framework.Unthinking
G
44

You could also check your package.json:

"dependencies": {
    "@angular/common": "^5.0.0",
    "@angular/compiler": "^5.0.0",
    "@angular/core": "^5.0.0",
    "@angular/forms": "^5.0.0",
    "@angular/http": "^5.0.0",
    "@angular/platform-browser": "^5.0.0",
    "@angular/platform-browser-dynamic": "^5.0.0",
    "@angular/router": "^5.0.0",
  }

(The caret ^ will update you to the most recent major version (the first number). ^4.3.0 will match any 4.x.x release including 4.4.0, but will hold off on 5.0.0. The tilde ~ matches the most recent minor version (the middle number). ~4.3.0 will match all 4.3.x versions, but will miss 4.4.0.)

Grip answered 9/5, 2017 at 20:33 Comment(1)
Handy if your Angular application is not started yet ! But works only if you have the source code, of course. For an online remote application, see Tony Dong's answer, inspecting the main angular tag in the DOM seems to work for any Angular2+ version.Macey
K
26

Now it is ng -v

If you are useing angular cli then you can check useing

ng --version

Now it is ng -v

Or you can also check in

pakage.json file

 "dependencies": {
    "@angular/animations": "^4.0.0",
    "@angular/common": "^4.0.0",
    "@angular/compiler": "^4.0.0",
    "@angular/core": "^4.0.0",
    "@angular/forms": "^4.0.0",
    "@angular/http": "^4.0.0",
    "@angular/platform-browser": "^4.0.0",
    "@angular/platform-browser-dynamic": "^4.0.0",
    "@angular/router": "^4.0.0",
    "angular-in-memory-web-api": "^0.3.2",
    "core-js": "^2.4.1",
    "rxjs": "^5.1.0",
    "zone.js": "^0.8.4"
  },
Kleiman answered 19/7, 2017 at 9:7 Comment(0)
H
24

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+

Hooknosed answered 7/8, 2018 at 13:48 Comment(1)
ng -v is not working in latest angular version (I checked for angular 8)Hooknosed
G
16

Another way would be to import VERSION constant from @angular/core and then dumping to console with:

console.log(VERSION.full); //5.2.11

Works in:

Not sure about Angular 2 and 3. (if someone could test that; pages are not available)


For AngularJS 1.x use angular.version:

console.log(angular.version); //1.7.4
Georgiegeorgina answered 11/9, 2018 at 13:9 Comment(0)
A
14

To Angular 4, many of the options no longer work. Update July 2017 Two posibilities:

1) The simplest one is to open the package.json of our project and to check the versions used, among them the one of Angular.

enter image description here

2) After executing ng serve, we open the inspector of elements of the explorer that we use and we can observe the version as in the following image.

enter image description here

Agist answered 24/7, 2017 at 12:21 Comment(2)
So which from all the lines says which version of Angular it is?Glossolalia
@Glossolalia @angular/core and the siblings (here it means that this is Angular 4, latest update due to the ^ in front)Macey
F
11

Just Run ng v in command

You will get result like

Angular CLI: 7.3.9
Node: 12.11.0
OS: win32 x64
Angular: 7.2.15
... common, compiler, compiler-cli, core, f
... language-service, platform-browser, pla
... router

Package                           Version
-------------------------------------------
@angular-devkit/architect         0.13.9
@angular-devkit/build-angular     0.13.9
@angular-devkit/build-optimizer   0.13.9
@angular-devkit/build-webpack     0.13.9
@angular-devkit/core              7.3.9
@angular-devkit/schematics        7.3.9
@angular/cli                      7.3.9
@ngtools/webpack                  7.3.9
@schematics/angular               8.0.0
@schematics/update                0.13.9
rxjs                              6.5.3
typescript                        3.1.6
webpack                           4.29.0
Fidellas answered 29/10, 2019 at 12:5 Comment(0)
A
9

If you are using angular-cli, simply use command:

ng v
Arathorn answered 9/1, 2018 at 12:9 Comment(0)
E
8

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.
Electrojet answered 25/2, 2019 at 9:15 Comment(0)
D
6

Attention: The following only checks the Angular-CLI version!!!:

Both commands work:

ng -v

or

ng v

enter image description here

Deepfreeze answered 25/2, 2018 at 12:51 Comment(2)
That is the version of "Angular CLI", not the version of "Angular".Shocking
angular cli 7 has command "ng version", which includes angular versionAlbatross
D
6

For angular 4+ use,

  • ng version
  • ng v

Please note ng -v option does not work in Angular 7+.

Dynamoelectric answered 30/12, 2018 at 18:41 Comment(0)
W
5

For AngularJS - Use angular.version

console.log(angular.version);
<script src="//unpkg.com/angular/angular.js"></script>

For more information, see

Wharton answered 2/10, 2019 at 22:53 Comment(0)
B
4

If you are using VS Code editor .

Go to Explorer panel on left side -> find package.json & open it -> under dependencies find @angular/core.

This is your angular version as core is the main feature

enter image description here

enter image description here

Batt answered 27/11, 2018 at 17:24 Comment(0)
O
3

There are multiple ways:

  1. You may verify it from your package.json file
  2. You use the following command:

ng --version

The command above will result in the following output:

Angular CLI: 7.0.3

Node: 9.4.0

OS: darwin x64

Angular: 7.0.1

... animations, common, compiler, compiler-cli, core, forms

... http, language-service, platform-browser

... platform-browser-dynamic, router

Package Version


@angular-devkit/architect 0.10.3

@angular-devkit/build-angular 0.10.3

@angular-devkit/build-optimizer 0.10.3

@angular-devkit/build-webpack 0.10.3

@angular-devkit/core 7.0.3

@angular-devkit/schematics 7.0.3

@angular/cli 7.0.3

@ngtools/webpack 7.0.3

@schematics/angular 7.0.3

@schematics/update 0.10.3

rxjs 6.3.3

typescript 3.1.4

webpack 4.19.1

So, the version of Angular, Angular CLI, Node and many other packages can be verified from here.

Outbalance answered 5/11, 2018 at 6:10 Comment(0)
G
2

On your project folder, open the command terminal and type

ng -v

it will give you a list of items, in that you will be able to see the angular version. See the screenshot.

version details

Galliett answered 10/3, 2018 at 16:57 Comment(1)
Angular CLI: 1.7.3 Node: 8.9.0 OS: win32 x64 Angular: ... not showing as per screen shotHierarchize
N
2

version after angular 2 you can use from terminal,

ng -v



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

Angular CLI: 1.7.3
Node: 9.3.0
OS: linux x64
Angular: 5.2.9
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cli: 1.7.3
@angular-devkit/build-optimizer: 0.3.2
@angular-devkit/core: 0.3.2
@angular-devkit/schematics: 0.3.2
@ngtools/json-schema: 1.2.0
@ngtools/webpack: 1.10.2
@schematics/angular: 0.3.2
@schematics/package-update: 0.3.2
typescript: 2.5.3
webpack: 3.11.0
mohideen@root:~/apps/UI$ 
Nestle answered 28/3, 2018 at 7:0 Comment(0)
G
2

For Angular 2+

Inspect Element (Ctrl + Shift + I)

goTo Elements section and scroll to <app-root> tag (refer picture below)

inspectElement

Graniah answered 20/4, 2021 at 14:33 Comment(0)
D
1

just go to your angular project directory via terminal and ng -v give all information like this

Angular CLI: 1.7.4
Node: 8.11.1
OS: linux x64
Angular: 5.2.11
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cli: 1.7.4
@angular-devkit/build-optimizer: 0.3.2
@angular-devkit/core: 0.3.2
@angular-devkit/schematics: 0.3.2
@ngtools/json-schema: 1.2.0
@ngtools/webpack: 1.10.2
@schematics/angular: 0.3.2
@schematics/package-update: 0.3.2
typescript: 2.5.3
webpack: 3.11.0

If you check ng-v outside angular project directoty then it will show only angular-cli version.

Depicture answered 7/6, 2018 at 5:44 Comment(1)
yes, if you want to see the Angular version, you have to go inside a project folder.Vestavestal
T
1

You can also check it by inspecting the elements on the page:

  1. press F12 to open Browser's developer tools.

  2. Inspect an Element.

  3. Expand Body

  4. You will see the version of Angular, like the following:

ng-version="4.3.6"

Thaumaturge answered 10/8, 2018 at 4:45 Comment(0)
B
1

enter image description hereIn the new version of angular cli the [ng -v] will not work.yoy have to type [ng version].

Bolitho answered 5/12, 2018 at 5:34 Comment(0)
A
1

For angular JS you can find it on angular-animate.js file as below:

/** * @license AngularJS v1.4.8 * (c) 2010-2015 Google, Inc. http://angularjs.org * License: MIT */

Anthropophagy answered 17/7, 2019 at 4:40 Comment(0)
I
0

It will be Here..

../project_name/bower_components/angular/angular.js

/**
 * @license AngularJS v1.0.6
 * (c) 2010-2012 Google, Inc. http://angularjs.org
 * License: MIT
 */
Inference answered 19/4, 2018 at 13:12 Comment(0)
T
0

you can just type ng version thats it

Triplex answered 29/6, 2018 at 1:26 Comment(0)
A
0

It's very simple, you can see in package.json file

Ailee answered 5/12, 2018 at 6:42 Comment(0)
S
0

Same like above answer, you can check in browser by inspecting element, if it is AngularJS we can see something like below.

The ng-app directive tells AngularJS that this is the root element of the AngularJS application.

All AngularJS applications must have a root element.

Steel answered 17/7, 2019 at 0:57 Comment(0)
T
0
1. ng --version (For checking Installed Angular Version in system)

2. npm --version (For checking Installed NPM Version in system) 

3. node --version (For checking Installed Node Version in system) 
Tribute answered 6/9, 2021 at 4:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.