Angular Reload Window Then Go To A New State
Background I have a large angular app with many forms for many items. I have lists of action objects. These actions have schemaforms. These actions form's dropdown's differ from on
Solution 1:
This answer only uses $window
to do a reload
upon entering the action page. But avoids recursion by using a hash.
var currentHref = $window.location.href
if (!currentHref.includes("refresh")) {
$window.location.href = $window.location.href + "#refresh"
$window.location.reload(true);
}
More explanation below
This code enables a full reload after a redirect. It is run upon entering the new page.
First time through, the url does not contain 'refresh', so $window.location.href
changes to contain 'refresh'. BUT this does not reload the page. Only the line after it reloads the page and clears the cache. But, the reload only happened after the hash was added.
So, I engaged in a full reload without an infinite loop that happens automatically upon entering the page
Post a Comment for "Angular Reload Window Then Go To A New State"