Closed ArielGueta closed 8 years ago
So there are basically two ways you can do this.
I would recommend you to take a look at https://github.com/dagstuan/ng2-redux-router which makes this much easier. The current route becomes part of the store, and you can navigate to other pages by dispatching route actions.
Also, to batch several actions into one bunch, before notifying subscribers, take a look at https://github.com/tshelburne/redux-batched-actions
Hope this helps you .. cheers
Thank you for your answer, I do have a session reducer to manage my session status.
I will try your solutions.
Hi @arielgueta - I have also seen that error in the situation you describe.
It's due to the peculiar way in which router configuration and NgModule execution happen during Angular2's initialisation sequence.
A quick fix if you want to continue the observable approach is to move your NgRedux.configureStore call into your app's top level component instead of in the NgModule constructor itself. That will allow Angular2 to boot thing in the right order.
It's unfortunate that router works this way; I believe it's a side effect of the way NgModules and lazy-loaded routes are implemented.
Thanks for the suggestion. I do prefer to continue the observable approach so I will try your solution.
hi need a help can any one help me i want to redirect to a next page on the click of the login button in angular 2 project
@spock123
2. and then perform routing
so you mean to use the router directly in the actions creator service?
I an using redux-observable like in your example but I don't know how to redirect the user to a different page after the login action success.
I am trying to Inject the Router to SessionEpics but it's throwing an error:
Bootstrap at least one component before injecting Router