2.2.0 • Published 8 years ago

angular-2-redux v2.2.0

Weekly downloads
6
License
MIT
Repository
github
Last release
8 years ago

Redux bindings for angular 2

UPDATE

  • Works now with Angular2 beta.1
  • Pure ES6 example app in the repository

Quick start

  1. Install via NPM
npm install angular-2-redux
  1. Bootstrap provider
import reduxBindProvider from 'angular-2-redux';

...

bootstrap(App, [
    reduxBindProvider(store)
]);
  1. Inject reduxStore into component
  • Injections are not supported as parameter decorators anymore as this doesnt comply with the ES7 standard
  • Thus use @Reflect.metadata directly() as shown in the example
...

@Reflect.metadata('parameters', [[new InjectMetadata('reduxStore')]])
class Content {
    constructor(reduxStore) {
        this.reduxStore = reduxStore;

...
  1. angular-2-redux supports Rxjs observables or direct component binding

With a direct bind, your components properties will get updated directly.

Binding components directly will automatically update the .appState property of the component. e.g. this.appState.XYZ where XYZ is the redux store property.

this.unsubscribe = reduxStore.bindStore()(this);

Using the observable, you will be notified on every update and can handle it like with a listening function.

this.source = reduxStore.createObservable();
this.source.subscribe((state) => {
    console.log(state);
});

Example

Take a look in build/testApp.

  1. Install live-server
npm install -g live-server
  1. Run live server and navigate to build/testApp
live-server
2.2.0

8 years ago

2.1.2

8 years ago

2.1.1

8 years ago

2.1.0

8 years ago

2.0.0

8 years ago

1.0.12

8 years ago

1.0.10

8 years ago

1.0.9

8 years ago

1.0.8

8 years ago

1.0.7

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago