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

前端 未结 28 975
死守一世寂寞
死守一世寂寞 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:55

    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 */

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

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

    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

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

    For AngularJS - Use angular.version

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

    For more information, see

    • AngularJS API Reference - angular.version
    0 讨论(0)
  • 2020-11-28 18:59

    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.

    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.

    0 讨论(0)
  • 2020-11-28 19:00

    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:

    • Angular 8 See docs
    • Angular 7 See docs
    • Angular 6 See docs.
    • Angular 5 See docs
    • Angular 4 See docs

    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
    
    0 讨论(0)
提交回复
热议问题