Problem with function in interval

Good community, I have the following problem. I want to run a function that queries a webservice from time to time. This had no major problems, however, is not not run every so often, if not, it gives me error code like “this is not defined” is weird, because if I is defined as making a call to the function manually works perfect. I’ll let my code to see if I can help. Any improvements or suggestions are very welcome.

$scope.resultados = misCorredoresService.getCorredores();
$scope.estadisticasParticipante = function(tagid, pid){
    if(navigator.onLine){
  $http({method: 'GET', url: URL_ESTADISTICAS+pid+'/splits?   pidversion=1&igt='+pid+'&appid='+appId+'&token='+tokenApp})
  .success(function(data){
    if(data.error){
      if(data.error.type=="no_results" && data.error.msg=="No splits found"){
         function alertDismissed() {}
          function showAlert() {
              navigator.notification.alert(
                  'No se han encontrado puntos.',  // message
                  alertDismissed,         // callback
                  'Alerta',            // title
                  'Aceptar'                  // buttonName
              );
          }
          showAlert();
       }
     }
    for(var i = $scope.groups.length - 1; i >= 0; i--){
        $scope.groups[tagid].items.splice(i,1);
    }
    respuestas = data.list;
    resp = respuestas;
        function sortResults(prop, asc) {
          resp = resp.sort(function(a, b) {
              if (asc) return (a[prop] > b[prop]) ? 1 : ((a[prop] < b[prop]) ? -1 : 0);
              else return (b[prop] > a[prop]) ? 1 : ((b[prop] < a[prop]) ? -1 : 0);
          });
          $scope.groups[tagid].items.push(resp);
        }
    sortResults('time',true);
  })
  .error(function(){
      function alertDismissed() {}
      function showAlert() {
          navigator.notification.alert(
              'Ha ocurrido un error inesperado.',  // message
              alertDismissed,         // callback
              'Error',            // title
              'Aceptar'                  // buttonName
          );
        }
      showAlert();
    });
}else{
  function alertDismissed() {}
  function showAlert() {
    navigator.notification.alert(
          'No tienes conexión a internet, recuerda que para seguir a tu amigo, familiar o rider favorito durante la competencia es necesaria una conexión a internet.',  // message'Ha ocurrido un error inesperado.',  // message
          alertDismissed,         // callback
         'Notificación',            // title
        'Aceptar'                  // buttonName
            );
   } 
  showAlert();
}
 }

  $scope.actualizarDatos = function(){
    if(misCorredoresService.getCorredores().length>=0){
      var actual_corredores = misCorredoresService.getCorredores();
      console.log(actual_corredores);
      for(var i = misCorredoresService.getCorredores().length - 1; i >= 0; i--){
          console.log(actual_corredores[i].pid);
      
      }
    }
 }
 setInterval(function(){$scope.actualizarDatos()}, 1000);

})

The error I get is “the items concept has not been declared” as you can see I declare in the same controller, I call the function in the same controller so I do not know of that sends that error.

up! please help me :c

Up up up up :frowning: help me!