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

我试过:

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

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

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

但是如何获得angularjs版本呢?


当前回答

如果你正在使用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

其他回答

有很多方法,你检查角版本只是压抑的命令 提示(用于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+

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 4+,

在版本中 的 v

请注意ng -v选项在Angular 7+中不起作用。

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

有多种方法:

您可以从您的包中验证。json文件 使用如下命令:

的 --版本

上面的命令将导致以下输出:

Angular CLI: 7.0.3 Node: 9.4.0 OS: darwin x64 Angular: 7.0.1 ... animations, common, compiler, compiler-cli, core, forms ... http, language-service, platform-browser ... platform-browser-dynamic, router Package Version @angular-devkit/architect 0.10.3 @angular-devkit/build-angular 0.10.3 @angular-devkit/build-optimizer 0.10.3 @angular-devkit/build-webpack 0.10.3 @angular-devkit/core 7.0.3 @angular-devkit/schematics 7.0.3 @angular/cli 7.0.3 @ngtools/webpack 7.0.3 @schematics/angular 7.0.3 @schematics/update 0.10.3 rxjs 6.3.3 typescript 3.1.4 webpack 4.19.1

因此,Angular、Angular CLI、Node和许多其他包的版本都可以从这里验证。