-
The Flux pattern, with Angular 2 and Observables
I’m going to run through how to implement the flux pattern in Angular 2 using observables.
In particular I hope the post conveys the following key concepts:
- Views only generate actions, and are not two way data bound to data models.
- Actions use a dispatcher to centralise the distribution of events.
- Data stores subscribe to the dispatcher and update themselves when relevant events are raised.
- Views subscribe to changes in the data store and update when the stores update.
- The pub / sub model for the dispatcher and data stores are implemented using RxJS observables.
Update: This was built with an alpha version of Angular 2, and some of the angular semantics have changed since the beta release. However the key principles still hold.
subscribe via RSS