Created
April 12, 2018 11:59
-
-
Save GrandSchtroumpf/110998868c6242d50adbac64b374c684 to your computer and use it in GitHub Desktop.
Import ngrx into our module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { NgModule } from '@angular/core'; | |
import { CommonModule } from '@angular/common'; | |
import { environment } from './../../environments/environment'; | |
// Web3 | |
import { WEB3 } from './tokens'; | |
const Web3 = require('web3'); | |
// Services | |
import { AccountsService } from './eth.services'; | |
// NGRX | |
import { StoreModule } from '@ngrx/store'; | |
import { EffectsModule } from '@ngrx/effects'; | |
import { StoreDevtoolsModule } from '@ngrx/store-devtools'; | |
// MODULE FACTORY | |
@NgModule({ | |
imports: [ | |
CommonModule, | |
StoreModule.forRoot(...), | |
EffectsModule.forRoot([...]), | |
environment.production ? [] : StoreDevtoolsModule.instrument(), | |
], | |
providers: [AccountsService, { | |
provide: WEB3, | |
useFactory: () => new Web3(Web3.givenProvider || "ws://localhost:8546"), | |
}] | |
}) | |
export class EthereumModule {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment