Skip to content

Instantly share code, notes, and snippets.

@WuglyakBolgoink
Last active July 31, 2020 18:40
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 WuglyakBolgoink/5f62091a0d2dbc7236d7115f52275397 to your computer and use it in GitHub Desktop.
Save WuglyakBolgoink/5f62091a0d2dbc7236d7115f52275397 to your computer and use it in GitHub Desktop.
ngrx@9.2.0 store setup
  1. open https://ngrx.io/docs

  2. install packages

npm install @ngrx/store --save
npm install @ngrx/store-devtools --save
npm install @ngrx/effects --save
npm install @ngrx/entity --save
npm install @ngrx/schematics --save-dev
  1. To use @ngrx/schematics as the default collection in your Angular CLI project, add it to your angular.json
ng config cli.defaultCollection @ngrx/schematics
  1. generate store module
ng g m <store_module_name>
  1. generate "root" store
cd <store_module_name>
ng generate store <store_name> --module <store_module_name> --root -d
  1. generate "feature" stores
ng generate feature feature-stores/<fstore_name>/<fstore_name> --module <store_module_name> --group --creators --api=false --flat -d
  1. update RootState in /src/app/modules/<store_module_name>/reducers/index.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment