Angular $interval without scope refresh

I have a $interval in an Angular service which check if an array is empty or not and run a script on each data of the array. This is something quite simple. My problem is that each time the $interval is running my scope is refreshed an few directives are "run again". If I use a javascript setInterval function instead of $interval, the result is what I expect. But I would like to use $interval since I don't know how to mock calls to setInteval while running karma tests. Any ideas on how to use $interval for this need ?

It's hard to know for sure without seeing your code, but I believe you could set the 4th parameter (invokeApply) to false when calling $interval. That should prevent the behind-the-scenes call to $scope.$apply(), which I believe is what's happening here.

See the $interval documentation for more details.