Angular中的应用版本如何显示和控制?
How to display and control the app version in Angular?
我想在angular 8
中控制我网站的版本
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"module": "esnext",
"moduleResolution": "node",
"importHelpers": true,
"target": "es2015",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2018",
"dom"
]
},
"angularCompilerOptions": {
"fullTemplateTypeCheck": true,
"strictInjectionParameters": true
}
}
一个选项是在 environment.ts 中管理版本,然后您可以将环境注入到您的应用程序或页脚组件中,并将绑定 属性 的值设置为该版本。这允许您在每个环境中使用不同的版本。有点像。
// environment.ts
export const environment {
production: false,
version: '1.2.0'
...
}
@Component(...)
export class FooterComponent {
version: string;
constructor(environment) {
this.version = enviroment.version;
}
}
我想在angular 8
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"module": "esnext",
"moduleResolution": "node",
"importHelpers": true,
"target": "es2015",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2018",
"dom"
]
},
"angularCompilerOptions": {
"fullTemplateTypeCheck": true,
"strictInjectionParameters": true
}
}
一个选项是在 environment.ts 中管理版本,然后您可以将环境注入到您的应用程序或页脚组件中,并将绑定 属性 的值设置为该版本。这允许您在每个环境中使用不同的版本。有点像。
// environment.ts
export const environment {
production: false,
version: '1.2.0'
...
}
@Component(...)
export class FooterComponent {
version: string;
constructor(environment) {
this.version = enviroment.version;
}
}