The function should be initiated every n-seconds:
app.controller('prmServiceHeaderAfterController',[function () {
var vm = this;
vm.func_name = function func_name(obt-var) {
var timesRun = 0;
var checkExistenceOfElement = setInterval(function () {
// ...
}
}, 50);
};
vm.func_name();
}]);
This function only works when the page is manually refreshed.