|
3 | 3 |
|
4 | 4 | For Angular 2 see [ng2-redux](https://github.com/wbuchwalter/ng2-redux). |
5 | 5 |
|
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. |
7 | 7 |
|
8 | 8 | [](https://travis-ci.org/wbuchwalter/ng-redux) |
9 | 9 | [](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] |
39 | 39 | ## Getting Started |
40 | 40 |
|
41 | 41 | #### 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) |
43 | 52 |
|
44 | 53 | ```JS |
45 | 54 | import reducers from './reducers'; |
46 | | -require('ng-redux'); |
| 55 | +import {combineReducers} from 'redux'; |
| 56 | +import loggingMiddleware from './loggingMiddleware'; |
| 57 | +import 'ng-redux'; |
47 | 58 |
|
48 | 59 | angular.module('app', ['ngRedux']) |
49 | 60 | .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]); |
53 | 63 | }); |
54 | 64 | ``` |
55 | 65 |
|
|
0 commit comments