Created
February 5, 2019 10:18
-
-
Save jocafi/214c12d5c0e01e17022a6f9046b87168 to your computer and use it in GitHub Desktop.
How to display app version from package.json in Angular
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
////////////////////////// | |
// 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