Angular bindings for Redux.
For Angular 1 see ng-redux
Redux is a popular approach to managing state in applications. It emphasises:
You can find lots of excellent documentation here: Redux.
We provide a set of npm packages that help you integrate your redux store into your Angular 2+ applications. Our approach helps you by bridging the gap with some of Angular's advanced features, including:
NgModule
and Ahead-of-Time compilation.Here are some examples of the angular-redux
family of packages in action:
@angular-redux/store
uses an approach to redux based on RxJS Observables to select
and transform
data on its way out of the store and into your UI or side-effect handlers. Observables
are an efficient analogue to reselect
for the RxJS-heavy Angular world.
Read more here: Select Pattern
We also have a number of 'cookbooks' for specific Angular topics:
Want to hack on angular-redux/store or any of the related packages? Feel free to do so, but please test your changes before making any PRs.
Here's how to do that:
npm test
.npm run lint
.Test your changes in a 'real world scenario'. We use the example-app for this, using some npm fakery to 'publish the package locally':
clone the example app (git clone https://github.com/angular-redux/example-app.git
)
cd
to your angular-redux/store
clone and run npm pack
). This will create a .tgz
file.cd
to your example-app clone and run npm install --save /path/to/the/tgz/file/from/above
)ng serve --aot
Please make sure your changes pass Angular's AoT compiler, because it's a bit finicky with TS syntax.
Auto-dispatches the return value of the decorated function.
Decorate a function creator method with @dispatch and its return value will automatically be passed to ngRedux.dispatch() for you.
Call this on your root reducer to enable SubStore functionality for pre-configured stores (e.g. when using NgRedux.provideStore()). NgRedux.configureStore does it for you under the hood.
Selects an observable from the store, and attaches it to the decorated property.
A selector function, property name string, or property name path (array of strings/array indices) that locates the store data to be selected
Function used to determine if this selector has changed.
Selects an observable using the given path selector, and runs it through the given transformer function. A transformer function takes the store observable as an input and returns a derived observable from it. That derived observable is run through distinctUntilChanges with the given optional comparator and attached to the store property.
Think of a Transformer as a FunctionSelector that operates on observables instead of values.
Generated using TypeDoc
Modifies the behaviour of any
@select
,@select$
, or@dispatch
decorators to operate on a substore defined by the IFractalStoreOptions.See https://github.com/angular-redux/store/blob/master/articles/fractal-store.md for more information about SubStores.