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

@district01/ng-redux-router

Package Overview
Dependencies
Maintainers
6
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@district01/ng-redux-router

Sync Angular (2+) router state with redux, including: current path, current url, query params, route params, fragment, previous route.

  • 2.0.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-25%
Maintainers
6
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 @district01/ng-redux-router --save

Import component in app.module.ts:

import { ReduxRouterModule } from '@district01/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);
}

Usage

The ReduxRouter will listen for route changes and store the current, previous and active (pending) route in the state. 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
  • queryParams: 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.

Keywords

FAQs

Package last updated on 31 Jan 2018

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