@nx/angular:ngrx
Adds NgRx support to an application or library.
Nx Launch Week & Launch Conf are coming up!Nx Launch Week & Launch Conf are coming up!Don't miss out!
This generator is deprecated and will be removed in a future version of Nx. Use the 'ngrx-root-store' and 'ngrx-feature-store' generators instead.
Adds NgRx support to an application or library.
1nx generate ngrx ...
2
By default, Nx will search for ngrx
in the default collection provisioned in workspace.json.
You can specify the collection explicitly as follows:
1nx g @nx/angular:ngrx ...
2
Show what will be generated without writing to disk:
1nx g ngrx ... --dry-run
2
Add root ngrx configration to the my-app
application:
1nx g @nx/angular:ngrx --root --parent=apps/my-app/src/app/app.module.ts --facade=false placeholder
2
Add a users
state with a facade to the my-lib
library. It will be tracked under the default +state
folder in the lib:
1nx g @nx/angular:ngrx --parent=libs/my-lib/src/lib/my-lib.module.ts --facade=true --root=false users
2
Add a root state configuration to my-app
when my-app
uses Standalone APIs:
1nx g @nx/angular:ngrx --parent=apps/my-app/src/app/app.config.ts --root
2
Add a users
feature state to the Route definition of a library using Standalone APIs:
1nx g @nx/angular:ngrx --parent=libs/my-lib/src/lib.routes.ts users
2
Name of the NgRx feature state, such as products
or users
. Recommended to use the plural form of the name.
The path to the file where the state will be registered. For NgModule usage, this will be your app.module.ts
for your root state, or your Feature Module for feature state. For Standalone API usage, this will be your app.config.ts
file for your root state, or the Routes definition file for your feature state. The host directory will create/use the new state directory.
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.
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.