@nx/angular:ngrx
Adds NgRx support to an application or library.
Adds NgRx support to an application or library.
nx generate ngrx ...
By default, Nx will search for ngrx
in the default collection provisioned in workspace.json.
You can specify the collection explicitly as follows:
nx g @nx/angular:ngrx ...
Show what will be generated without writing to disk:
nx g ngrx ... --dry-run
Add root ngrx configration to the my-app
application:
nx g @nrwl/angular:ngrx --root --module=apps/my-app/src/app/app.module.ts --facade=false placeholder
Add a users
state with a facade to the my-lib
library. It will be tracked under the default +state
folder in the lib:
nx g @nrwl/angular:ngrx --module=libs/my-lib/src/lib/my-lib.module.ts --facade=true --root=false users
Name of the NgRx feature state, such as products
or users
. Recommended to use the plural form of the name.
The path to the NgModule
or the Routes
definition file (for Standalone API usage) where the feature state will be registered. The host directory will create/use the new state directory. Note: The Standalone API usage is only supported in Angular versions >= 14.1.0.
false
Setup root or feature state management with NgRx.
false
Use barrels to re-export actions, state and selectors.
+state
The name of the folder used to contain/group the generated NgRx files.
false
Create a Facade class for the the feature.
true
Only register the root state management setup or feature state.
''
The route that the Standalone NgRx Providers should be added to. Note: This is only supported in Angular versions >= 14.1.0.
false
Generate NgRx feature files without registering the feature in the NgModule.
false
Skip formatting files.
false
Do not update the package.json
with NgRx dependencies.
The path to the NgModule
where the feature state will be registered. The host directory will create/use the new state directory.
This option will be removed in a future version of Nx. Please switch to using --parent instead.