Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70429

Ionic continue get data from webservice after change page

$
0
0

@tuliofoliveira wrote:

Hi,

I made this function for get data from a rails webservice, and insert new value in the chart every second. This works well, but when I click in back to return to other screen, I see in rails terminal, the ionic application continue get data. I want when the screen changes (and controller), this get stops.

My code:

var countUp = function() {

   if (experimentStatus) {
      $scope.timeInMs+= 1000;
      acquisition_time = $scope.timeInMs / 1000;

      $http.get(get_acquisition_data_url)
  .success(function(response) {
    $scope.graph.data[0].push(response.temp);
    $scope.graph.labels.push((acquisition_time));
  });
  $timeout(countUp, 1000);
  }
}

What I have to do, to finish this function after change page?
Thanks

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70429

Trending Articles