I have some computations in myapp.config functions. They are performed when the page is loaded (or bootstrapped). I need to repeat these computations after that (e.g. after clicking a button or authentication ;-)).
So what I need is
- Execute myapp.config functions while loading the page. That is performed natively by Angular.
- The user clicks the button (that is just an example).
- Execute myapp.config functions again. how can I do that?
$router.reload() (or $state from ui-router) reloads controllers, config functions will not be executed again.
$window.location.reload() will do that but the page will be reloaded, I do not want to reload the page (i.e. the user should not see that I'm hacking around).
Manual bootstrapping may be what I need but I'm not sure how to use it for this. I cannot execute the following code twice (for the first load and after the user clicked the button) because of the error "the element is already bootstrapped".
angular.element(document).ready(function() {
angular.bootstrap(document, ['myapp']);
});
Any ideas how I can execute config code twice?