-
open https://ngrx.io/docs
-
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
- 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
- generate store module
ng g m <store_module_name>
- generate "root" store
cd <store_module_name>
ng generate store <store_name> --module <store_module_name> --root -d
- generate "feature" stores
ng generate feature feature-stores/<fstore_name>/<fstore_name> --module <store_module_name> --group --creators --api=false --flat -d
- update RootState in /src/app/modules/<store_module_name>/reducers/index.ts