Skip to content

Instantly share code, notes, and snippets.

@pablotolentino
Last active March 24, 2021 05:46
Show Gist options
  • Save pablotolentino/9728edecad6316d3fbf333cad803aa78 to your computer and use it in GitHub Desktop.
Save pablotolentino/9728edecad6316d3fbf333cad803aa78 to your computer and use it in GitHub Desktop.
export class AppComponent implements OnInit {
constructor(private httpClient: HttpClient) {
}
private config: {version: string};
ngOnInit() {
this.config = require("./../assets/config.json");
console.log(this.config.version);
const headers = new HttpHeaders()
.set('Cache-Control', 'no-cache')
.set('Pragma', 'no-cache');
this.httpClient
.get<{ version: string }>("/assets/config.json", {headers})
.subscribe(config => {
console.log(config);
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment