Skip to content

Instantly share code, notes, and snippets.

@alanxone
Last active May 5, 2020 01:03
Show Gist options
  • Save alanxone/1b0ae0e7b08988b9747f4b6a321a13d3 to your computer and use it in GitHub Desktop.
Save alanxone/1b0ae0e7b08988b9747f4b6a321a13d3 to your computer and use it in GitHub Desktop.
NGRX Tutorial - Module
// NGRX Complete Tutorial Without Pain (Angular6 / RxJS6)
// https://medium.com/@andrew.kao/ngrx-complete-tutorial-without-pain-angular6-rxjs6-5511b8cb8dac
import { CommonModule } from '@angular/common';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { StoreModule } from '@ngrx/store';
import { reducers } from '(team main reducer -> the index.ts)';
import { AuthService } from '(auth service)';
import { AuthGuard } from '(auth guard)';
import { AuthEffects } from '(auth effect)';
import { Routes } from '(routes)';
import { HttpClientModule } from '@angular/common/http';
import { EffectsModule } from '@ngrx/effects';
import { RouterModule } from '@angular/router';
@NgModule({
declarations: [AppComponent],
imports: [
BrowserModule,
CommonModule,
RouterModule.forRoot(Routes),
FormsModule,
// HttpClient is imported, cause I supposed you use RESTful API to check credentials
HttpClientModule,
// Since we create a feature selector, we now use the pre-defined alias `team` here
StoreModule.forFeature('team', reducers),
EffectsModule.forFeature([AuthEffects])
],
providers: [AuthService, AuthGuard],
bootstrap: [AppComponent]
})
export class AppModule {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment