Skip to content

Commit ae5b164

Browse files
committed
Update README.md
1 parent 7f53228 commit ae5b164

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

README.md

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
For Angular 2 see [ng2-redux](https://github.com/wbuchwalter/ng2-redux).
55

6-
#####Warning: The API is unstable and subject to breaking changes until Redux@1.0.0 is released.
6+
#####Warning: The API is unstable and subject to breaking changes.
77

88
[![build status](https://img.shields.io/travis/wbuchwalter/ng-redux/master.svg?style=flat-square)](https://travis-ci.org/wbuchwalter/ng-redux)
99
[![npm version](https://img.shields.io/npm/v/ng-redux.svg?style=flat-square)](https://www.npmjs.com/package/ng-redux)
@@ -39,17 +39,27 @@ If you have a good reason to mutate your states, you can still [disable caching]
3939
## Getting Started
4040

4141
#### Initialization
42-
You need to pass Redux Store to ng-redux via ```$ngReduxProvider``` :
42+
43+
$ngReduxProvider.createStoreWith(reducer, ['promiseMiddleware', loggingMiddleware]);
44+
45+
```JS
46+
$ngReduxProvider.createStoreWith(reducer, [middlewares], storeEnhancer);
47+
```
48+
#### Parameters:
49+
*reducer (Function): A single reducer composed of all other reducers (create with redux.combineReducer)
50+
*[middleware] (Array of Function or String): An array containing all the middleware that should be applied. Functions and strings are both valid members. String will be resolved via Angular, allowing you to use dependency injection in your middlewares.
51+
*storeEnhancer: Optional function that will be used to create the store, in most cases you don't need that, see [Store Enhancer official doc](http://rackt.github.io/redux/docs/Glossary.html#store-enhancer)
4352

4453
```JS
4554
import reducers from './reducers';
46-
require('ng-redux');
55+
import {combineReducers} from 'redux';
56+
import loggingMiddleware from './loggingMiddleware';
57+
import 'ng-redux';
4758

4859
angular.module('app', ['ngRedux'])
4960
.config(($ngReduxProvider) => {
50-
let reducer = redux.combineReducers(reducers);
51-
let store = redux.createStore(reducer);
52-
$ngReduxProvider.setReduxStore(store);
61+
let reducer = combineReducers(reducers);
62+
$ngReduxProvider.createStoreWith(reducer, ['promiseMiddleware', loggingMiddleware]);
5363
});
5464
```
5565

0 commit comments

Comments
 (0)