Created
December 18, 2016 20:27
-
-
Save jorgeramirez/bc30322be89874370e7571b0475714a5 to your computer and use it in GitHub Desktop.
ng-redux + redux-persist
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import angular from 'angular'; | |
import ngRedux from 'ng-redux'; | |
import {persistStore, autoRehydrate} from 'redux-persist'; | |
angular.module('demo', [ | |
ngRedux | |
]) | |
.config(config) | |
.run(run); | |
config.$inject = ['$ngReduxProvider']; | |
function config($ngReduxProvider) { | |
const middleware = ['apiMiddleware']; | |
let reducer = combineReducers({ | |
... | |
}); | |
$ngReduxProvider.createStoreWith(reducer, middleware, [autoRehydrate()]); | |
} | |
run.$inject = ['$ngRedux']; | |
function run($ngRedux) { | |
persistStore($ngRedux); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment