1

I'm trying to create a cache to avoid some calls on a request (API - REST).

I'm doing it with a map where keys are userId and the value the response (get from the API).

It's working, my problem is when I'm refreshing the page (more like the addin) with F5.

So the question is: What happens to elements like properties in service after a refresh? My map is clear, but why? Because refresh an addin work differently (it work as a reboot of the application)? Is it normal with Angular?

1 Answer 1

3

Refreshing a page refreshes the entire Angular application. It regets the application from the server and reloads it. No data or property values are retained.

If you need to cache data on the client that is accessible across refreshes, you can use localstorage.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks ! Ok, so i can't do it without localstorage.Thanks again for your time.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.