[Angulalr] Speed Up Reducer Development Using Ngrx Schematics

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:

猜你喜欢

转载自www.cnblogs.com/Answer1215/p/9098304.html