Hi,
I have an SPA and in one of the pages i have a chart that updates 
continuously using http.get through $interval. Unfortunately, it keeps 
running even when i go a different page/tab. How do i cancel the request 
when navigating away from the page. Appreciate any help.
 
.controller('myCtrl', function ($scope, $http, $timeout, $modal, $interval) 
{
            $scope.getData = function() { 
$http.get('http://localhost:8080/getData?q=' + queries)
                .success(function(data) {
                            console.log(data);
                /* Business logic here */
            }).error(function (data, status){
                console.log("Error status : " + status + " " + data);
            }) };

           *promise = $interval($scope.getData, 3000);*
*}*

*Thanks in advance for your help.*

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to