Home > Software engineering >  Retain data on page refresh using Rxjs
Retain data on page refresh using Rxjs

Time:11-30

I have a service in Angular which contains a Behaviour Subject that gets an initial value from the database and gets new values from a form.

Currently, once the user fills out the form to filter a search and refreshes the page, the form would get the values from the database and not the last applied values.

Is there a way to retain the data once the user refreshes the page without using local/session storage but using Rxjs and angular?

CodePudding user response:

If your form doesn't contain a lot of inputs, You can create a state object and encode it in Base64 and append it to the URL. And on page Load you can fill the form using it.

  • Related