我如何知道我使用的是哪个版本的Angular ?

我试过:

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

但是没有找到get -bash: angular:命令

通过yeoman -version我知道我使用的是0.9.6

但是如何获得angularjs版本呢?


当前回答

另一种方法是从@angular/core导入VERSION常量,然后转储到控制台:

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

适用于:

Angular 8参见docs Angular 7参见docs Angular 6参见文档。 Angular 5参见docs Angular 4参见docs

Angular 2和3不太确定。(如果有人能测试一下;网页不可用)


对于AngularJS 1。使用angular.version:

console.log(angular.version); //1.7.4

其他回答

你可以输入ng版本 这是它

你可以从终端使用angular 2之后的版本,

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$ 
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) 

对于angular JS,你可以在angular- animation . JS文件中找到它,如下所示:

/** * AngularJS v1.4.8 * (c) 2010-2015谷歌,Inc. http://angularjs.org *授权:MIT * /

对于Angular 1或2(但不适用于Angular 4+):

你也可以在你使用的任何浏览器的开发工具上打开控制台,输入angular。来访问持有angular version的Javascript对象。

当脚本没有头注释时非常有用。