Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@studiohyperdrive/ng-redux-router

Package Overview
Dependencies
Maintainers
9
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@studiohyperdrive/ng-redux-router

Sync Angular Router state with the Redux app state, gaining easy access to the entire route, not just the activated route.

  • 5.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
Maintainers
9
Weekly downloads
 
Created
Source

Angular Redux Router

Sync Angular Router state with the Redux app state, gaining easy access to the entire route, not just the activated route.

Dependencies

  • @angular/router

Installation

npm install @studiohyperdrive/ng-redux-router --save

or

yarn add @studiohyperdrive/ng-redux-router

Import module in app.module.ts:

import { ReduxRouterModule } from '@studiohyperdrive/ng-redux-router';

@NgModule({
    imports: [
        ReduxRouterModule
    ]
})

export class AppModule {}

Initialize ReduxRouter with a dispatch function (e.g. using the @angular-redux/store package:

constructor(
    private ngRedux: NgRedux<MyAppState>,
    private reduxRouter: ReduxRouter
) {
    reduxRouter.initialize(ngRedux.dispatch);
}

You can find examples for a vanilla implementation, angular-redux and ngrx in the examples folder. All examples can be run using the angular-cli.

Usage

The ReduxRouter will listen for route changes and store the current, previous and active (pending) route for the entire route tree in the state (i.e. from the root, not just the parts applicable for the component context).

The following properties are stored for each route:

  • url: the complete path including queryParams & fragments
  • path: the url path without queryParams & fragments
  • frament: the current active fragment
  • query: all queryParams found on the route
  • params: all route params found on the route

The ROUTE_UPDATE action will only be dispatched once the NavigationEnd event is triggered.

Known issues

  • The angular-redux package is not actively maintained anymore but still works fine, if you lock your redux version to 4.0.1. There are some type issues in newer versions.
  • When using replaceUrl when navigating, the route is not updated correctly.

FAQs

Package last updated on 08 Jun 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc