Opening a modal window on navigation change or closing a window - angularjs

So I'm looking to have my app open a modal popup window if a user tries to navigate away from a page or close the tab/browser with unsaved data on a form.
I've had people tell me this isn't possible as angular makes asynchronous callbacks and as such once you stop the event in order to open the modal and prevent the navigation the contents of the event are lost.
Is it possible to store the contents of the event in an object?

Related

How to open a nonmodal child dialog that gets focused again when parent is refocused

I work on an MDI application where all Forms are opened as separate tabs.
I would like to open a dialog (non-modal) from one tabbed form which then sticks with this form.
I would like to have the dialog hide when another tab (form) is navigated to. But as soon as I navigate back to the form which opened the dialog, the dialog should be still visible as well.
Do I have to do this by hand? If I just show the dialog form like
form.Show(this)
where "this" is the parent form, the dialog just goes to the background when navigating away and is not focused again when navigating to the parent.

How can I handle browser tab close event in React? Only close, not refresh

My goal is when browser tab closed calling function logout.
Is it possible? Can I handle browser tab close event without refresh case?
If I use beforeunload or unload events, function triggered when user refresh page, I don't want this, I want just run when closed tab.
How can I do this in React Js?

How to avoid blocking new window popup in AngularJS

I've an issue on opening new page window in my Angular JS project if popup is being blocked.
Do you have any solution on bypass popup/new window blocking in IE > 8
Note; It's not a button click event to open new window.
If you are referring to the window popup using window.open() you can't specially if the user has blocked popup's from their browser that popups blocked icon at the rightmost part of the url bar or in the browser settings then you can't do anything about it.

Re-disable background for uibModal popup in AngularJS

https://angular-ui.github.io/bootstrap/
AngularJS uibModal popup question.
I have a form where I am entering certain input fields and selecting multiple dropdown. On selection of dropdown a web API call triggers, then on submitting the form I opening uibModal popup. Till now web Api call is in pending state, popup is open and background is disabled. If user does not not perform any action on uibmodal then after 30-40 seconds response comes from web API which was triggered on dropdown selection, now the background is enabled and popup remains open.
I have two different controllers, one where popup and web API call is triggered and one for uibModal popup.
I want to re disable the background when the web API response comes.
Thanks in Advance!

Angular ui router and implementing overlay with back button

I'm having issues with an overlay panel.
The first page loads, you click a link... It pops up an overlay, the router fires a state and controller, and it populates the contents of the overlay.
There is a back button on the overlay, I trigger the overlay to close, call window.history.back() which sends the router off to load the new url (previous url) and it runs it through the router again but obviously refreshes the backing page in doing so.
So the end result is when you press a link, the overlay slides out beautifully, you then press back, the overlay slides back in, it then refreshes the page. You'd think then, why not just say in the controller, if there was an overlay and now there isn't do not change the view content... I can't, as the template stuff gets placed into the ui-view which is remove all my content.
So I need a way of changing the url without running through all of the controller stuff again so to avoid the template being inserted.
Any ideas on how to do this? Or examples of it working somewhere else.

Resources