Damian Hetman Damian Hetman - 3 months ago 21
AngularJS Question

Ionic Interval error - TypeError: fn is not a function

I need help with my app. I tried to refresh function every 5 seconds. Console shows "TypeError: fn is not a function". This is my code:

$scope.getItems = function (){
$scope.news = res;
.error(function(data, status) {


$interval($scope.getItems(), 5000);


For an interval, you have to pass the function, in this case your executing the function directly and pass the return value to $interval (which is undefined).

So change your code to this and it should work! :)

 $interval($scope.getItems, 5000);