redux-ui-router icon indicating copy to clipboard operation
redux-ui-router copied to clipboard

Allow middleware to be exportable

Open Millsky opened this issue 6 years ago • 1 comments

When trying to use a separate store with ng-redux, it is not possible to use this package unless you manually import the router-middleware.

This (routerMiddleware) should be exported from redux-ui-router main index file, so it it more easily compilable by webpack / babel.

The $state service can be manually injected, by using a proxy $injector on the DOM.

import routerMiddleware from '../../../node_modules/redux-ui-router/src/router-middleware';

const handler = {
    get: (obj, prop) => angular.element(document).injector().get('$state')[prop],
};

const stateProxy = new Proxy({}, handler);

export default routerMiddleware(stateProxy);```

Millsky avatar Sep 19 '18 17:09 Millsky

+1

dcogswell avatar Mar 12 '19 15:03 dcogswell