1
在Angular 1.x中,您可以使用 angular.version
来确定运行系统中的当前版本。确定当前的Angular 2.x版本
角度2.x中是否有类似的东西?我搜索了ng
,ng.core
,ng.common
和ng.compiler
没有任何运气的物体。
在Angular 1.x中,您可以使用 angular.version
来确定运行系统中的当前版本。确定当前的Angular 2.x版本
角度2.x中是否有类似的东西?我搜索了ng
,ng.core
,ng.common
和ng.compiler
没有任何运气的物体。
从Angular 2.3.0-rc0及更高版本中包含的this commit开始,您可以使用来自@angular/core
的VERSION
常量。
import { Component, VERSION } from '@angular/core';
@Component({
selector: 'angular-version',
template: '<p>Version: {{version}}</p>'
})
export class VersionComponent {
version: string = VERSION.full;
}
如果你只需要获得开发者工具的版本,你可以试试
document.querySelector('[ng-version]').getAttribute('ng-version')
或检查app-root
元素。
也许看看'@ angular/upgrade'模块。像这样的东西可能在那里。 – martin
Thx @Martin,但不幸的是它没有。 – MEMark