Angular Tips
Introduction
In an effort to reduce the resource google needs for my small memory (4K), I have added this page to capture some of the issues/solutions encounter on my journey.
Putting the NPM Version on the App
We need to add this to the tsconfig.json
"compilerOptions": {
...
"resolveJsonModule": true,
"esModuleInterop": true,
},
We then need to access it via the whole file as just importing version fails with "Error: Should not import the named export 'version'"
import packageInfo from './../../package.json'
...
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
})
export class AppComponent implements OnDestroy {
appVersion = packageInfo.version
...