Scaffolding library for Angular applications using NgRx libraries.
@ngrx/schematics provides blueprints for generating files when building out feature areas using NgRx. Built on top of Schematics
, it integrates with the Angular CLI
to make setting up and expanding NgRx in Angular applications easier.
Install @ngrx/schematics from npm:
npm install @ngrx/schematics --save-dev
yarn add @ngrx/schematics --dev
npm install github:ngrx/schematics-builds --save-dev
yarn add github:ngrx/entity-builds --dev
After installing @ngrx/schematics
, install the NgRx dependencies.
npm install @ngrx/{store,effects,entity,store-devtools} --save
yarn add @ngrx/{store,effects,entity,store-devtools}
To use @ngrx/schematics
as the default collection in your Angular CLI project,
add the following to the defaults
section in your .angular-cli.json
.
"schematics": {
"collection": "@ngrx/schematics"
}
The collection schema also has aliases to the most common blueprints used to generate files.
Generate the initial state management and register it within the app.module.ts
ng generate store State --root --module app.module.ts --collection @ngrx/schematics
Generate the root effects and register it within the app.module.ts
ng generate effect App --root --module app.module.ts --collection @ngrx/schematics