Skip to content

Commit 49aacb3

Browse files
committed
docs: update README with ng add support
1 parent 62deaa4 commit 49aacb3

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

projects/angular-redux/README.md

+27-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
Official Angular bindings for [Redux](https://github.com/reduxjs/redux).
44
Performant and flexible.
55

6-
76
![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/reduxjs/angular-redux/test.yml?style=flat-square) [![npm version](https://img.shields.io/npm/v/@reduxjs/angular-redux.svg?style=flat-square)](https://www.npmjs.com/package/@reduxjs/angular-redux)
87
[![npm downloads](https://img.shields.io/npm/dm/@reduxjs/angular-redux.svg?style=flat-square)](https://www.npmjs.com/package/@reduxjs/angular-redux)
98

@@ -14,6 +13,32 @@ Performant and flexible.
1413

1514
Angular Redux requires **Angular 17.3 or later**.
1615

16+
### Installing with `ng add`
17+
18+
You can install the Store to your project with the following `ng add` command <a href="https://angular.dev/cli/add" target="_blank">(details here)</a>:
19+
20+
```sh
21+
ng add @reduxjs/angular-redux@latest
22+
```
23+
24+
#### Optional `ng add` flags
25+
26+
| flag | description | value type | default value |
27+
|---------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------|---------------
28+
| `--path` | Path to the module that you wish to add the import for the StoreModule to. | `string` |
29+
| `--project` | Name of the project defined in your `angular.json` to help locating the module to add the `provideRedux` to. | `string` |
30+
| `--module` | Name of file containing the module that you wish to add the import for the `provideRedux` to. Can also include the relative path to the file. For example, `src/app/app.module.ts`. | `string` | `app`
31+
| `--storePath` | The file path to create the state in. | `string` | `store` |
32+
33+
This command will automate the following steps:
34+
35+
1. Update `package.json` > `dependencies` with Redux, Redux Toolkit, and Angular Redux
36+
2. Run `npm install` to install those dependencies.
37+
3. Update your `src/app/app.module.ts` > `imports` array with `provideRedux({store})`
38+
4. If the project is using a `standalone bootstrap`, it adds `provideRedux({store})` into the application config.
39+
40+
## Installing with `npm` or `yarn`
41+
1742
To use React Redux with your Angular app, install it as a dependency:
1843

1944
```bash
@@ -35,7 +60,7 @@ modules](https://webpack.js.org/api/module-methods/#commonjs).
3560

3661
The following Angular component works as-expected:
3762

38-
```angular-ts
63+
```typescript
3964
import { Component } from '@angular/core'
4065
import { injectSelector, injectDispatch } from "@reduxjs/angular-redux";
4166
import { decrement, increment } from './store/counter-slice'

0 commit comments

Comments
 (0)