First, I found this answer, but they do not suit..
My problem is, that I want my AngularJS part of my application to reload something, when the user is redirected back to the page. The login flow is like this
a.php -> [FB Magic] -> callback.php -> a.php
My problem is <body onload="foo()">
fires only once. The same is true for DOMContentLoaded
and window.onload
as well.
For a.php it is like the user never left the page.
How can I make AngularJS call a function (which is defined within a controller), when the user is redirected back? (I am using PHP for redicting back
EDIT: How my controller looks like ->
pwm.controller('EventListController', ['$scope', 'pwmApi',
function EventListController($scope, pwmApi) {
$scope.fetched = false;
$scope.events = [];
let update = function () {
<!-- Does stuff, is a bit long ->
};
update();
}]);
So :) The update(); method is called on Construction of the controller. When I am redirected back the update-function is NOT called - Refreshing the page helps.
I sincerly hope this clarification helped. Reloading the page after getting redirected back helps, but now nothing happens...