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

我试过:

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

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

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

但是如何获得angularjs版本呢?


当前回答

对于Angular 2+,在任何带有开发人员工具的现代浏览器(F12)中,你都可以查看顶级应用程序标签。

对于Internet Explorer 11或Edge,您可以在这里找到相关信息:

适用于Angular 2+ Chrome浏览器

Firefox的firebug

其他回答

如果你正在使用angular-cli,只需使用命令:

ng v

它就在这里。

. . / project_name bower_components /角度/ angular.js

/**
 * @license AngularJS v1.0.6
 * (c) 2010-2012 Google, Inc. http://angularjs.org
 * License: MIT
 */

你可以从终端使用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$ 

如果你正在使用angular-cli,那么你可以通过输入很容易地检查它

ng -v

或者在Angular 8、在Terminal或Bash中使用ng v。注意:在工程项目目录下运行该命令。

你应该得到这样的东西:

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

另一种方法是从@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