From 3ee8563f09928614951f37314e79a2bf9a90c43a Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Fri, 26 Jun 2020 09:14:59 +0200 Subject: [PATCH] @ngrx/store installiert Mit dem Befehl: ng add @ngrx/store --minimal false --- package-lock.json | 5 +++++ package.json | 1 + src/app/app.module.ts | 8 +++++++- src/app/reducers/index.ts | 19 +++++++++++++++++++ 4 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 src/app/reducers/index.ts diff --git a/package-lock.json b/package-lock.json index 4d8f28b..1510777 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1710,6 +1710,11 @@ } } }, + "@ngrx/store": { + "version": "9.2.0", + "resolved": "https://registry.npmjs.org/@ngrx/store/-/store-9.2.0.tgz", + "integrity": "sha512-V8AI3mxbMztVpbZpALkLZYlGkofKcu9GaOCY5e+sZ1VcJ90oxhFjBpnmd6MuVdmhep1XAHALb1B8ZbBFn+xsgQ==" + }, "@ngtools/webpack": { "version": "9.1.4", "resolved": "https://registry.npmjs.org/@ngtools/webpack/-/webpack-9.1.4.tgz", diff --git a/package.json b/package.json index 3598a2c..ea6520a 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "@angular/platform-browser": "~9.1.5", "@angular/platform-browser-dynamic": "~9.1.5", "@angular/router": "~9.1.5", + "@ngrx/store": "^9.2.0", "angular-in-memory-web-api": "^0.11.0", "rxjs": "~6.5.5", "tslib": "^1.10.0", diff --git a/src/app/app.module.ts b/src/app/app.module.ts index c35475a..ccb148f 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -13,6 +13,8 @@ import { HeroDetailComponent } from './hero-detail/hero-detail.component'; import { MessagesComponent } from './messages/messages.component'; import { DashboardComponent } from './dashboard/dashboard.component'; import { HeroSearchComponent } from './hero-search/hero-search.component'; +import { StoreModule } from '@ngrx/store'; +import { reducers, metaReducers } from './reducers'; @NgModule({ declarations: [ @@ -34,7 +36,11 @@ import { HeroSearchComponent } from './hero-search/hero-search.component'; // Remove it when a real server is ready to receive requests. HttpClientInMemoryWebApiModule.forRoot( InMemoryDataService, { dataEncapsulation: false } - ) + ), + + StoreModule.forRoot(reducers, { + metaReducers + }) ], providers: [], bootstrap: [AppComponent] diff --git a/src/app/reducers/index.ts b/src/app/reducers/index.ts new file mode 100644 index 0000000..4f57bb0 --- /dev/null +++ b/src/app/reducers/index.ts @@ -0,0 +1,19 @@ +import { + ActionReducer, + ActionReducerMap, + createFeatureSelector, + createSelector, + MetaReducer +} from '@ngrx/store'; +import { environment } from '../../environments/environment'; + +export interface State { + +} + +export const reducers: ActionReducerMap = { + +}; + + +export const metaReducers: MetaReducer[] = !environment.production ? [] : []; -- 2.20.1