作者:NOYOKI要跑偏 | 来源:互联网 | 2023-10-12 13:46
WhenweuseNGRX,weneedtocreatesomebolipates.NowwithAngulalr6,wecanuseCLItogeneratethosecodef
When we use NGRX, we need to create some bolipates. Now with Angulalr6, we can use CLI to generate those code for us.
Install:
@ngrx/schematics: Scaffolding library for Angular applications using NgRx.
npm install @ngrx/schematics --save-dev
npm install @ngrx/{store,effects,entity,store-devtools} --save
Config:
ng config cli.defaultCollection @ngrx/schematics
Create a root store:
ng generate store State --root --module app.module.ts
Create a feature store:
ng g feature travel/store/Travel --group true --module travel/travel.module.ts
The structure we want is like: