How to get back data entered in html controls on clicking of back button in browser in Angular - angularjs

I am retain earlier values in web page controls once user click on back button in browser .
I want to do that in Angular application.
Please suggest

There is no specific way to tell when a user presses the back button.
What you can do, is call an ngDestroy hook and set local Storage items in the hook, refer to this article on how to set local storage items:
https://medium.com/#tiagovalverde/how-to-save-your-app-state-in-localstorage-with-angular-ce3f49362e31

Related

Browser back functionality in angular js

How to make the browser back functionality in angular? If the browser back button is clicked, the previous state data remain selected in the old page.
Please share your idea.

trigger angular event/function when user clicks back on browser

I don't need any routing, location or window.history change, just prevent default and insert my own function instead.
It's also important that the back button will be clickable when the app starts.
It seems so simple but somehow i can't write/find a simple solution...

Redirecting to previous page without reloading

I have a question that suppose, I have an Admin Dashboard page, on which I have given a list of users. clicking upon a particular user the details of corresponding user is shown on a different page (say on userDetails.jsp). Now I have a back button on userDetails page, Clicking of which I need to redirect admin to the last visited page that is Admin Dashboard page, I have one solution that I can "Reload" the previos page on clicking back button, but then I feel that there is the overhead of calling a server side API, retrieving all the data, Again redraw the whole admin dashboard page even when there is no change made in the userDetails[because it is read only page, modification is not allowed there]. Is there anyway that I can make user of cache or anything else so that I will not need to go to the server to fetch all the data again. I am using spring MVC, angularjs, Thank you.
On your button's click event add the following code:
$window.history.back();
make sure to use $window rather than window since you're using AngularJS

How to change URL but not view Angular JS

I have a view for which route has been defined. On the view I have a no of images and when I click any of them the Modal Dialog appears with the detail of that image. What I want to do is to change the url only when the modal appears so user can easily share them. And yes, the share url would be another route I will define so when user directly come to that one, the modal pops in. Any suggestion please?
I would not change the URL when a modal appears. A modal is an overlay of your page and actually not a new page with a new URL.
Many image hosters, however, show the URL in a read-only field under the picture so that users can copy it. Maybe this is the way you would like to go.
On the page itself I recommend using $location to determine if there is an imageId in your URL. If so, just invoke the same logic as if a user clicked on that image on the page.

how to create a custom splash page in salesforce?

Need to show a popup message in home page only for the first time a user logs into salesforce....
its more like a splash page.
it can be a jquery popup as well..
can i do it using a visualforce page ??? if yes, please give ur suggestions
can we do it using the sidebar component in salesforce ???
I thought of showing it using a sidebar component by keeping a custom field in user object...everytime he logs in i will check the custom field and the show the popup...since this popup will be shown only for the first time is there anyother better solution instead of querying the user object evertime..
thanks.
You can use window.open method of Javascript and for the sidebar provide your scroll option.
If you want to get fancy to have customized look you can just use jquery modal with some style on document ready.
We can use cookie to store if this is the first time or salesforce user object can tell you this is the first time

Resources