Skip to content

Instantly share code, notes, and snippets.

@GrandSchtroumpf
Last active September 2, 2018 12:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GrandSchtroumpf/7789360e07386245634e57c7b8cf3853 to your computer and use it in GitHub Desktop.
Save GrandSchtroumpf/7789360e07386245634e57c7b8cf3853 to your computer and use it in GitHub Desktop.
A module to provide the URI of an Ethereum node
import { NgModule, ModuleWithProviders, InjectionToken} from '@angular/core';
export const URL = new InjectionToken<string>('url');
@NgModule({
imports: [HttpClientModule]
})
export class ProviderModule {
static init(url: string): ModuleWithProviders {
return {
ngModule: ProviderModule,
providers: [{ provide: URL, useValue: url }]
};
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment