Flu*_*ine 278 angularjs angular
我怎么知道我使用的Angular版本是什么?
我试过了:
angular --version
angular --v
angular -version
angular -v
Run Code Online (Sandbox Code Playgroud)
但得到 -bash: angular: command not found
我知道yeoman --version我正在使用0.9.6
但如何获得angularjs版本?
lol*_*ski 295
对于Angular 1或2(但不适用于Angular 4+):
您还可以在您使用的任何浏览器的开发人员工具上打开控制台,并键入angular.version以访问包含角度版本的Javascript对象.
当脚本缩小而没有标题注释时非常有用.
The*_*ppo 205
编辑:当写这个答案时,只有Angular 1.x. 请查看下面的Angular版本> = 2的答案.
Angular没有命令行工具.
您可以从JavaScript文件本身获取版本号.
当前的标题angular.js:
/**
* @license AngularJS v1.0.6
* (c) 2010-2012 Google, Inc. http://angularjs.org
* License: MIT
*/
Run Code Online (Sandbox Code Playgroud)
Ton*_*ong 149
对于Angular 2+,在任何具有开发工具(F12)的现代浏览器中,您都可以检查顶级应用程序标记.
对于Internet Explorer 11或Edge,您可以在此处找到信息:
适用于Angular 2+ Chrome浏览器
Firefox firebug
Ist*_*ván 105
如果您正在使用angular-cli,则可以通过键入来轻松查看
ng -v
Run Code Online (Sandbox Code Playgroud)
在终端或Bash.注意:在项目目录中运行该命令.
你应该得到这样的东西:
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
Run Code Online (Sandbox Code Playgroud)
Sum*_*ick 74
在浏览器的开发人员控制台中(按F12打开它),您可以键入以下内容,
angular.version.full
Run Code Online (Sandbox Code Playgroud)
它将为您提供完整版本,例如(取决于您当前的版本).[它实际上获得了对象的full属性angular.version.]
"1.4.3"
Run Code Online (Sandbox Code Playgroud)
因此,要查看完整对象,如果键入
angular.version
Run Code Online (Sandbox Code Playgroud)
它将为您提供包含完整版本,主要版本,次要版本以及codeName等版本信息的完整版本对象
Object {full: "1.4.3", major: 1, minor: 4, dot: 3, codeName: "foam-acceleration"}
Run Code Online (Sandbox Code Playgroud)
Leo*_*Leo 39
你也可以查看你的package.json:
"dependencies": {
"@angular/common": "^5.0.0",
"@angular/compiler": "^5.0.0",
"@angular/core": "^5.0.0",
"@angular/forms": "^5.0.0",
"@angular/http": "^5.0.0",
"@angular/platform-browser": "^5.0.0",
"@angular/platform-browser-dynamic": "^5.0.0",
"@angular/router": "^5.0.0",
}
Run Code Online (Sandbox Code Playgroud)
(插入符^将更新到最新的主要版本(第一个数字).
^4.3.0将匹配任何4.x.x版本,包括4.4.0但将推迟5.0.0.代字号~匹配最新的次要版本(中间数字).
~4.3.0将匹配所有4.3.x版本,但会错过的4.4.0.)
sag*_*thi 22
现在是ng -v
如果您正在使用角度cli,那么您可以检查使用情况
ng --version
现在是ng -v
或者您也可以登记入住
pakage.json文件
"dependencies": {
"@angular/animations": "^4.0.0",
"@angular/common": "^4.0.0",
"@angular/compiler": "^4.0.0",
"@angular/core": "^4.0.0",
"@angular/forms": "^4.0.0",
"@angular/http": "^4.0.0",
"@angular/platform-browser": "^4.0.0",
"@angular/platform-browser-dynamic": "^4.0.0",
"@angular/router": "^4.0.0",
"angular-in-memory-web-api": "^0.3.2",
"core-js": "^2.4.1",
"rxjs": "^5.1.0",
"zone.js": "^0.8.4"
},
Run Code Online (Sandbox Code Playgroud)
Sri*_*hna 20
有很多方法,你检查角度版本只是压缩命令提示符(对于Windows)和类型
1. ng version
2. ng v
3. ng -v
Run Code Online (Sandbox Code Playgroud)
4. You can pakage.json file
Run Code Online (Sandbox Code Playgroud)
5.You can check in browser by presing F12 then goto elements tab
Run Code Online (Sandbox Code Playgroud)
完全理解关于(xxx)的颠覆,请参阅角度文档angularJS和angular 2+
Hug*_*L.M 14
对于Angular 4,许多选项不再有效.2017年7月更新两个职位:
1)最简单的方法是打开我们项目的package.json并检查使用的版本,其中包括Angular的版本.
2)执行ng serve后,打开我们使用的资源管理器元素的检查器,我们可以观察下图中的版本.
Eri*_*ric 10
另一种方法是使用以下方法从中导入VERSION常量@angular/core,然后将其转储到控制台:
console.log(VERSION.full); //5.2.11
Run Code Online (Sandbox Code Playgroud)
适用于:
不确定Angular 2和Angular2。(如果有人可以测试;页面不可用)
对于AngularJS 1.x使用angular.version:
console.log(angular.version); //1.7.4
Run Code Online (Sandbox Code Playgroud)
只需ng v在命令中运行
你会得到这样的结果
Angular CLI: 7.3.9
Node: 12.11.0
OS: win32 x64
Angular: 7.2.15
... common, compiler, compiler-cli, core, f
... language-service, platform-browser, pla
... router
Package Version
-------------------------------------------
@angular-devkit/architect 0.13.9
@angular-devkit/build-angular 0.13.9
@angular-devkit/build-optimizer 0.13.9
@angular-devkit/build-webpack 0.13.9
@angular-devkit/core 7.3.9
@angular-devkit/schematics 7.3.9
@angular/cli 7.3.9
@ngtools/webpack 7.3.9
@schematics/angular 8.0.0
@schematics/update 0.13.9
rxjs 6.5.3
typescript 3.1.6
webpack 4.29.0
Run Code Online (Sandbox Code Playgroud)
对于 Angular 1 或 2(但不适用于 Angular 4+):
您还可以打开控制台并转到您使用的任何浏览器的开发人员工具上的元素选项卡。
或者
输入 angular.version 以访问保存 angular 版本的 Javascript 对象。
对于 Angular 4+,有以下几种方式:
在命令提示符/或终端中的 VS 代码中编写以下代码。(最多 3 个)
- ng version 或 ng --version(查找图像以供参考)
- 吴
- ng -v
- 您还可以打开控制台并转到您使用的任何浏览器的开发人员工具上的元素选项卡。如下图所示:
- 找到 package.json 文件,您将找到所有已安装的依赖项及其版本。
注意:以下仅检查Angular-CLI版本!!!:
两个命令都有效:
ng -v
Run Code Online (Sandbox Code Playgroud)
要么
ng v
Run Code Online (Sandbox Code Playgroud)
angular.versionconsole.log(angular.version);Run Code Online (Sandbox Code Playgroud)
<script src="//unpkg.com/angular/angular.js"></script>Run Code Online (Sandbox Code Playgroud)
有关更多信息,请参阅
| 归档时间: |
|
| 查看次数: |
432974 次 |
| 最近记录: |