Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 228595

Ionic continue get data from webservice after change page

$
0
0

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


Viewing all articles
Browse latest Browse all 228595

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>