Skip to content

Instantly share code, notes, and snippets.

@guillefd
Created May 17, 2019 21:25
Embed
What would you like to do?
Import JSON in Angular
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import jsonCfg from '../../../data/config.json';
@Injectable()
export class AppCfg {
constructor(private http: HttpClient) {}
load(): Promise<void> {
return new Promise<void>((resolve, reject) => {
const jsonFile = <unknown>jsonCfg;
this.customCfg = <any>lokalumJsonFile;
console.log(`[CFG_LOADED]`);
resolve();
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment