2
Guys, I’m getting here to do an interval rsrs.
$rootScope.$on("timer", updateApanha());
var arquivoJSON = (JSON.parse(window.sessionStorage.getItem('timeUpdate'))*1000);
console.log(tempoDeAtualizacao);
function updateApanha(){
setInterval(getApanha, tempoDeAtualizacao);
console.log("get Apanha " +tempoDeAtualizacao);
}
The point is that the interval is set to Undefined. And because of that he keeps making the requisition all the time. What I wanted was that only when it was called $on that was set the interval to be able to call the function.
That way solved my problem. Just assign the function to the event.Ty
– Aleff