Skip to content

Instantly share code, notes, and snippets.



Last active Sep 10, 2018
What would you like to do?
App init for getting dynamic configuration on app startup
import { Injectable } from '@angular/core';;
import { from } from 'rxjs';
import { filter, map, switchMap, tap } from 'rxjs/operators';
declare var window: any;
export class AppInitService {
// This is the method you want to call at bootstrap
// Important: It should return a Promise
public init() {
return from(
fetch('assets/app-config.json').then(function(response) {
return response.json();
map((config) => {
window.config = config;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.