Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Retain page data on refreshing the page

I am new to angular. I am using a service which gets a list of objects and displays them on the 1st page. Then based on what object was clicked, I am setting the tab header on the next page. But while I am refreshing the page the scope of the list is lost and the tab header is throwing the exception resulting the page to not display the information. Is there any way to retain the information that which object was clicked on previous screen even when refreshing the 2nd page?

like image 910
Nutan Avatar asked Jun 04 '14 09:06

Nutan


People also ask

How do I refresh a page without losing data?

The easiest way to reload the current page without losing form data, use WebStorage where you have -persistent storage (localStorage) or session-based (sessionStorage) which remains in memory until your web browser is closed. window. onload = function() { var name = localStorage.

What happens when a page is refreshed?

For example, if you are on a web page, refreshing the page displays the most recent content published on that page. Essentially, you're asking the site to send your computer the newest version of the page you're viewing. 2. The refresh button, also known as the refresh option, is a function of all Internet browsers.


1 Answers

You can make use of angular local storage

Angular Local Storage

Example how to use it:

Example To Use Local Storage

like image 167
V31 Avatar answered Sep 24 '22 01:09

V31