2

I have a main parent component in angular that contains next and back button. The child components are 3-4 sections.

In a simpler words, this is a step wizard. When the first step which contains a form is filled and I navigate to the second section, the route changes and it loads a new component.

When I click back again i need to maintain data of the form without sending it to server using state management.

Can I achieve this by using angular and ngrx? Does ngrx have any solution on how to implement this in angular/ngrx?

Athanasios Kataras
  • 25,191
  • 4
  • 32
  • 61
Hel_UI
  • 115
  • 1
  • 1
  • 7

1 Answers1

0

There are plenty of ways to go with this.

  1. Create a singleton service that will keep that state on the clientside. You can do this without ngrx. You can use the service and inject it on all components. In the service, maintain a struct and share the model of the form there.
  2. Share the data from routing (not a good idea as described here
  3. If you want to use the ngrx-store, it is a viable option. There is no reason to go to the server. The store will maintain the latest state in the github here
Athanasios Kataras
  • 25,191
  • 4
  • 32
  • 61