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

我试过:

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

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

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

但是如何获得angularjs版本呢?


当前回答

这很简单, 你可以在包装上看到。json文件

其他回答

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

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

适用于Angular 2+ Chrome浏览器

Firefox的firebug

编辑:在写这个答案的时候,只有AngularJS 1.x。下面是Angular版本>= 2的答案。

AngularJS没有命令行工具。

您可以从JavaScript文件本身获得版本号。

当前angular.js的头文件:

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

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

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

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

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

有很多方法,你检查角版本只是压抑的命令 提示(用于windows)并键入

1. ng version
2. ng v
3. ng -v

4. You can pakage.json file

5.You can check in browser by presing F12 then goto elements tab

关于subversion (x.x.x)的完整理解,请参阅angular文档angularJS和angular 2+