Security News
The Risks of Misguided Research in Supply Chain Security
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
ng2-redux-router
Advanced tools
Updated for Angular 2 final release.
This package uses the new v3 router for angular 2 @angular/router@^3.1.2
.
npm install ng2-redux-router --save
routerReducer
when providing Store
:import { combineReducers } from 'redux';
import { routerReducer } from 'ng2-redux-router';
export default combineReducers<IAppState>({
// your reducers..
router: routerReducer
});
import { NgModule } from '@angular/core';
import { NgReduxModule, NgRedux } from 'ng2-redux';
import { NgReduxRouterModule, NgReduxRouter } from 'ng2-redux-router';
import { RouterModule } from '@angular/router';
import { routes } from './routes';
@NgModule({
imports: [
RouterModule.forRoot(routes),
NgReduxModule.forRoot(),
NgReduxRouterModule
// ...your imports
],
// Other stuff..
})
export class AppModule {
constructor(
ngRedux: NgRedux<IAppState>,
ngReduxRouter: NgReduxRouter
) {
ngRedux.configureStore(/* args */);
ngReduxRouter.initialize(/* args */);
}
}
When using a wrapper for your store's state, such as Immutable.js, you will need to change two things from the standard setup:
UPDATE_LOCATION
and return the payload merged into state.selectLocationFromState
option on NgReduxRouter
's initialize()
.These two hooks will allow you to store the state that this library uses in whatever format or wrapper you would like.
Depending on your app's needs. It may need to supply the current URL of the page differently than directly
through the router. This can be achieved by initializing the bindings with a second argument: urlState$
.
The urlState$
argument lets you give NgReduxRouter
an Observable<string>
of the current URL of the page.
If this argument is not given to the bindings, it defaults to subscribing to the @angular/router
's events, and
getting the URL from there.
FAQs
Bindings from the router in Angular 2 to the redux state
The npm package ng2-redux-router receives a total of 8 weekly downloads. As such, ng2-redux-router popularity was classified as not popular.
We found that ng2-redux-router demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.