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

前端 未结 28 1158
死守一世寂寞
死守一世寂寞 2020-11-28 18:23

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

I have tried:

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

but get

相关标签:
28条回答
  • 2020-11-28 18:50

    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
     */
    
    0 讨论(0)
  • 2020-11-28 18:50

    In the new version of angular cli the [ng -v] will not work.yoy have to type [ng version].

    0 讨论(0)
  • 2020-11-28 18:50

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

    0 讨论(0)
  • 2020-11-28 18:51

    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.

    0 讨论(0)
  • 2020-11-28 18:51

    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.

    0 讨论(0)
  • 2020-11-28 18:54

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

    ng v
    
    0 讨论(0)
提交回复
热议问题