How to find my version of angular in my project?

I installed angular code on my local computer. I need to know the version of angular that I use in the project. how can i easily find it on cmd command line?

+63
source share
6 answers

try this command:

ng --version

It prints versions of Angular, Angular CLI, Node, Typescript, etc.

+43
source

There are several ways to do this:

  • Go to node_modules/@angular/core/package.jsonand check the box version.
  • If you need to use it in your code, you can import it from @angular/core:

    import { VERSION } from '@angular/core';

  • Inspect the DOM render - Angular adds a version to the main component element:

    <my-app ng-version="4.1.3">

+40
source

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

, .

angular.version Javascript, .

Angular 4+ , :

/ VS Code.

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

, : enter image description here

  1. , . :

enter image description here

5. package.json. .

+20

VERSION .

import { VERSION } from '@angular/core';

Now you can use the VERSION variable in your code to print the version. For example,

console.log(VERSION.full); 
+11
source

For Angular 2+, you can run this in the console:

document.querySelector('[ng-version]').getAttribute('ng-version')

For AngularJS 1.x:

angular.version.full
+2
source

You can use ng --version for angular version 7

0
source

Source: https://habr.com/ru/post/1679067/


All Articles