如何在Angular中显示和控制应用程序版本?
我想在如何在Angular中显示和控制应用程序版本?,angular,angular-cli,Angular,Angular Cli,我想在angular 8 { "compileOnSave": false, "compilerOptions": { "baseUrl": "./", "outDir": "./dist/out-tsc", "sourceMap": true, "declaration": false, "downlevelIteration": true, "experimentalDecorators": true, "module": "e
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;
}
}