ng-redux icon indicating copy to clipboard operation
ng-redux copied to clipboard

Pass custom combine reducers function

Open hgsigner opened this issue 9 years ago • 2 comments

Hi,

This PR aims to add custom combineReducers function to the $ngReduxProvider, which is extremely helpfull if you want to use libraries such as redux-immutable for example.

import reducers from './reducers';
import myCombineReducers from 'redux-immutable';
import loggingMiddleware from './loggingMiddleware';
import ngRedux from 'ng-redux';

angular.module('app', [ngRedux])
.config(($ngReduxProvider) => {
    $ngReduxProvider.combineReducersFunc(myCombineReducers);
    reducer3 = functtion(state, action){}
    $ngReduxProvider.createStoreWith({
        reducer1: "reducer1",
        reducer2: function(state, action){},
        reducer3: reducer3
     }, ['promiseMiddleware', loggingMiddleware]);
  });

By passing $ngReduxProvider.combineReducersFunc(myCombineReducers);, ngRedux will use the new myCombineReducers function instead of the default one that comes with redux.

This PR starts from this other PR https://github.com/wbuchwalter/ng-redux/pull/76

Let me know what you think. Thanks

hgsigner avatar Apr 20 '16 20:04 hgsigner

@hgsigner I was thinking maybe you want to rename combineReducersFunc to setCombineReducersFunc to be more explicit

Fire-Dragon-DoL avatar Apr 24 '16 17:04 Fire-Dragon-DoL

@Fire-Dragon-DoL done.

hgsigner avatar Apr 25 '16 16:04 hgsigner