Angular and Flux can they work together?

时间:2015-10-29 15:41:53

标签: javascript angularjs model-view-controller flux redux

Flux is a unidirectional data flow originated in the React team, it hold many benefits (Undo/Redo, Easy to test, one State to the app, and more) and it would be nice to combine it with AngularJs.

Victor Savkin wrote a blog post on how to implement it using AngularJs, but he broke a basic concept of Flux by changing the store instead of re-creating a new instance of it. Another thing that bothers me is that Angular is using ng-model and data binding, using Flux means that we should not use these anymore...

Thinking about all these issues, sounds like Angular and Flux paradigmas are colliding.

Anyone ever really creating a working Angular in Flux that works (As expected)?

1 个答案:

答案 0 :(得分:0)

With the Flux folk recommending Redux instead, whether the latter and Angular can work together is perhaps a better question. On that, they certainly can be and I recently wrote a blog post http://simonh1000.github.io/2015/10/angular2-one-way-data-binding/. I'm not sure how efficient it is as Redux complement React whereas it substitutes for some of Angular's model handling.