Ionic $timeout not working on phone


#1

Hello everyone.

I have a very simple controller that has just few functions for now. It’s a temporary solution, but I need to get it to work for now. It has a $timeout directive called timer that calls the stateForward function in 3 seconds, which then cancels the timer, forwards to the next view and clears the cache:

 $scope.stateForward=function(){     
   $timeout.cancel($scope.timer);
   $state.go('app.newtView');
   $ionicHistory.clearCache();       

};

$scope.timer=$timeout(
$scope.stateForward,
3000
);

It works fine in browsers, but when I compile it to IOS or Android the view is just stuck and nothing happens.

Any help would be appreciated. Thanks.