I am making a demo in which I am fetching data from the server after regular intervals of time using $interval Now I need to stop/cancel this.
$interval
How I can
var promise = $interval(function(){ if($location.path() == '/landing'){ $rootScope.$emit('testData',"test"); $interval.cancel(promise); } },2000);