angular-redux/ng-redux

Add features ng2-redux like Observable Store, @select

BeaveArony opened this issue · 2 comments

Hi,
I was wandering if there are some considerations about back porting some of the functionality from ng2-redux.
I'm looking for a way to (re)select a slice of the state and get an Observable in AngularJS.

I would like to do this in my components:
const slice$ = $ngRedux.select(myMemoizedSelectorFn);

I'm pretty new to redux and love rxjs. Maybe this has been done in some other angularjs project?
It might help with migrating to Angular in the future, but is also great to have in AngularJS-Land I think.

I haven't considered it. I think rxjs might be a hard sell since it's an additional dependency while for Angular 2, the dependency is already available.

However, @select would be an awesome idea, I use it quite frequently in Angular 2

I think this would be a totally different concept and would rather fit in creating an AngularJS Branch for ng2-redux, where all Angular stuff is downgraded to AngularJS. Which is not much. I was playing with this idea a little bit, but it became too difficult.

I created a custom Store-Service in my Project, where I wrapped the redux stuff and exposed a BehaviourSubject like seen in ng2-redux.
Now I do most things similar to ngrx in the components:
this.data$ = this.store.select(myImportedSelector);
and use async pipes in the templates.
this.store.dispatch(myImportedActionCreator(payload)) for actions where I prefer to create plain objects instead of classes like discussed in the redux docs.
redux-observable is exactly like Effects in ngrx, I just miss the Effect decorator to easily combine all of them in the rootEpic out of angularjs services.

I think I prefer the way ng2-redux uses redux under the hood compared to ngrx. All the existing middleware, the enhancers and the awesome documention is easily reusable.

I'm using redux, redux-observable, reselect, rxjs, async pipe and ngrx/entity where I just replaced the Selector stuff with reselect. Feels like ngrx/ng2-redux, but in angularjs!

If somebody else is still working on a legacy project, this might be useful to know?