How does angular application handle refresh page and could we use $history on loading directives

angularjs, history, preserve, refresh, scope

Solution

If your url's are mapped with the `$routeProvider`, you can reload a controller invoking `$route.reload()`. This refresh the page without destroy the $rootScope. I have create a plunker to show this. The controller counts how many times the page has been reloaded.

Problem

So two questions. How does angular applications handle refresh page, b/c from what I heard, $rootScope destroy() on refresh and application gets re-run and re-config -ed, and I was wondering if there's an elegant way to preserve the $rootScope without having to store $rootScope variables as a string into a storage. If I load a template on a directive that loads a modal on the page, is it possible to configure history to not navigate but to revert the open modal. and due to validations and such, I do not think it is possible to implement same function using href.

Original source

Related problems