Skip to content

Instantly share code, notes, and snippets.

@jorgeramirez
Created December 18, 2016 20:27
Show Gist options
  • Save jorgeramirez/bc30322be89874370e7571b0475714a5 to your computer and use it in GitHub Desktop.
Save jorgeramirez/bc30322be89874370e7571b0475714a5 to your computer and use it in GitHub Desktop.
ng-redux + redux-persist
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