Skip to content

Instantly share code, notes, and snippets.

@jocafi
Created February 5, 2019 10:18
Show Gist options
  • Save jocafi/214c12d5c0e01e17022a6f9046b87168 to your computer and use it in GitHub Desktop.
Save jocafi/214c12d5c0e01e17022a6f9046b87168 to your computer and use it in GitHub Desktop.
How to display app version from package.json in Angular
//////////////////////////
// Follow the steps below
//////////////////////////
// Edit environment..ts
export const environment = {
VERSION: require('../../package.json').version
};
// Edit your component:
import { environment } from '../../environments/environment';
public version: string = environment.VERSION;
// Edit the file /src/tsconfig.app.json and include the node types:
{
"compilerOptions": {
"types": ["node"]
}
}
// check if your package.json has already the @types/node library. If not, execute:
// npm install @types/node -P
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment