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
export interface IApp { | |
username: string; | |
password: string; | |
authenticationMessage: string; | |
} | |
export interface IAppState { | |
AppState: IApp; | |
} |
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 { BrowserModule } from '@angular/platform-browser'; | |
import { NgModule } from '@angular/core'; | |
import { StoreDevtoolsModule } from '@ngrx/store-devtools'; | |
import { AppRoutingModule } from './app-routing.module'; | |
import { AppComponent } from './app.component'; | |
import { StoreModule } from '@ngrx/store'; | |
import { reducers, metaReducers } from './store'; | |
@NgModule({ |
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 { Component } from '@angular/core'; | |
import { Store } from '@ngrx/store'; | |
import { IAppState } from './store/app.interface'; | |
import { login } from './store/actions/app.actions'; | |
@Component({ | |
selector: 'app-root', | |
templateUrl: './app.component.html', | |
styleUrls: ['./app.component.scss'], | |
}) | |
export class AppComponent { |
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 { BrowserModule } from '@angular/platform-browser'; | |
import { NgModule } from '@angular/core'; | |
import { AppRoutingModule } from './app-routing.module'; | |
import { AppComponent } from './app.component'; | |
import { StoreModule } from '@ngrx/store'; | |
import { reducers, metaReducers } from './store'; | |
@NgModule({ | |
declarations: [AppComponent], |
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 { ActionReducerMap, MetaReducer } from '@ngrx/store'; | |
import { IAppState } from './app.interface'; | |
import { AppReducer } from './reducers/app.reducers'; | |
export const reducers: ActionReducerMap<IAppState> = { | |
AppState: AppReducer, | |
}; | |
export const metaReducers: MetaReducer<IAppState>[] = []; |
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 { createReducer, on, Action } from '@ngrx/store'; | |
import { initialAppState, IApp } from '../app.interface'; | |
import { login, loginSuccess, loginFail } from '../actions/app.actions'; | |
export const userFeatureKey = 'AppState'; | |
export const reducer = createReducer( | |
initialAppState as IApp, | |
on(login, (state) => ({ | |
...state, |
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 { createAction, props } from '@ngrx/store'; | |
export const login = createAction( | |
'[loginModule] log user Action', | |
props<{ usernamae: string; password: string }>() | |
); | |
export const loginSuccess = createAction( | |
'[loginModule] log user Success Action' | |
); |
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 { ActionReducerMap, MetaReducer } from '@ngrx/store'; | |
import { IAppState } from './app.interface'; | |
export const reducers: ActionReducerMap<IAppState> = {}; | |
export const metaReducers: MetaReducer<IAppState>[] = []; |
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 { BrowserModule } from '@angular/platform-browser'; | |
import { NgModule } from '@angular/core'; | |
import { AppRoutingModule } from './app-routing.module'; | |
import { AppComponent } from './app.component'; | |
import { StoreModule } from '@ngrx/store'; | |
@NgModule({ | |
declarations: [ | |
AppComponent |
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
{ | |
"name": "ngrx-store-walkthrough", | |
"version": "0.0.0", | |
"scripts": { | |
"ng": "ng", | |
"start": "ng serve", | |
"build": "ng build", | |
"test": "ng test", | |
"lint": "ng lint", | |
"e2e": "ng e2e" |
NewerOlder