How do I display the app version in angular application? the version should be taken from package.json file
{
\"name\": \"angular-app\",
\"v
If you're using webpack or angular-cli (which uses webpack), you can just require package.json in your component and display that prop.
const { version: appVersion } = require('../../package.json')
// this loads package.json
// then you destructure that object and take out the 'version' property from it
// and finally with ': appVersion' you rename it to const appVersion
And then you have your component
@Component({
selector: 'stack-overflow',
templateUrl: './stack-overflow.component.html'
})
export class StackOverflowComponent {
public appVersion
constructor() {
this.appVersion = appVersion
}
}