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

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

提交回复
热议问题