1.0.5 • Published 7 years ago

ng-redux-route v1.0.5

Weekly downloads
3
License
ISC
Repository
github
Last release
7 years ago

ng-redux-route

Usage:

import angular from 'angular';
import ngRoute from 'angular-route';
import { combineReducers } from 'redux';
import ngRedux from 'ng-redux';
import createLogger from 'redux-logger';
import ngReduxRoute, { routeActions, routeReducer } from 'ng-redux-route';


const rootReducer = combineReducers({
  //app: appReducer
  router: routeReducer,
});

const app = angular.module('app', [
  ngRoute,
  ngRedux,
  ngReduxRoute,
])
  .config(($ngReduxProvider) => {
    const logger = createLogger({
      level: 'info',
      collapsed: true,
    });
    $ngReduxProvider.createStoreWith(rootReducer, ['ngRouteMiddleware', logger]);
  })
  .run(($ngRedux) => {
    
  })
  .name;

export default app;

setLocation(setters)

$ngRedux.dispatch(routeActions.setLocation([
  { fn: 'search', args: ['company', 1] }, // $location.search('company', 1)
  { fn: 'replace' },                      // $location.replace()
])));

see $location documentation

const mapStateToThis = state => ({
  router: state.router,
});
const mapDispatchToThis = ({
  setLocation: routeActions.setLocation,
});
const unsubscribe = $ngRedux.connect(mapStateToThis, mapDispatchToThis)(this);
$scope.$on('$destroy', unsubscribe);

this.setLocation([
  { fn: 'url', args: ['/some-url'] }, //  $location.url('/some-url')
]);

see ngRedux documentation.

Location Helpers

setUrl(url, replace = false)

setPath(path, replace = false)

setSearch(search, paramValue, replace = false)

setHash(hash, replace = false)

setState(state, replace = false)

import { locationHelpers } from 'ng-redux-route';

locationHelpers.setUrl('/some-url', true)
// {
//   type: '@@ngReduxRoute/setLocation',
//   setters: [
//     {fn: "url", args: ['/some-url']},
//     {fn: "replace"},
//   ]
// }
1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.2.3

7 years ago

0.2.2

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.8

7 years ago

0.1.7

7 years ago

0.1.6

7 years ago

0.1.5

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.0.10

7 years ago

0.0.9

7 years ago

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago