title: Resource no refresh when i use slow connection o 3G angular js
body: <p>I 'm creating a mobile application based on angularjs . To load a list , I'm making a call to an API Rest. I am using a resource for doing this. When I 'm connected to the wifi it works perfectly , but when I use · g, the recuerso not call the API and always returns the previous value.</p>
  
  <p>How I can refresh the application each time you call?</p>
  
  <p><strong>SERVICES.JS</strong></p>
  
  <pre><code>.factory('Exercises', function($resource) {
  
  // localhost: Local
  // 79.148.230.240: server
  return $resource('http://79.148.230.240:3000/wodapp/users/:idUser/exercises/:idExercise', {
      idUser: '55357c898aa778b657adafb4',
      idExercise: '@_id'
  }, {
      update: {
          method: 'PUT'
      }
  });
  </code></pre>
  
  <p>});</p>
  
  <p><strong>CONTROLLERS</strong></p>
  
  <pre><code>.controller('ExerciseController', function($q, $scope, $state, Exercises) {
  
           // reload exercises every time  when we enter in the controller
           Exercises.query(function(data) {
               $scope.exercises = data;
           });
  
           // refresh the list of exercises
           $scope.doRefresh = function() {
  
               // reload exercises
               Exercises.query().$promise.then(function(data) {
                   $scope.exercises = data;
               }, function(error) {
                   console.log('error');
               });
  
               // control refresh element 
               $scope.$broadcast('scroll.refreshComplete');
               $scope.$apply();
           }
  
           // create a new execersie template
           $scope.newExercise = function() {
               $state.go('newExercise');
           };
  
           // delete a exercise
           $scope.deleteExercise = function(i) {
  
               // we access to the element using index param
               var exerciseDelete = $scope.exercises[i];
  
               // delete exercise calling Rest API and later remove to the scope
               exerciseDelete.$delete(function() {
                   $scope.exercises.splice(i, 1);
               });
           };
       })
  </code></pre>
  
  <p><strong>APP.js</strong></p>
  
  <pre><code>angular.module('wodapp', ['ionic', 'ngResource', 'wodapp.controllers','wodapp.services'])
  
  // Run
  .run(function($ionicPlatform) {
    $ionicPlatform.ready(function() {
      // ionic is loaded
    });
  })
  
  // Config
  .config(function($stateProvider, $urlRouterProvider, $ionicConfigProvider) {
    $stateProvider
      .state('slide', {
        url: '/',
        templateUrl: 'templates/slides.html',
        controller: 'SlideController'
      })
      .state('login', {
        url: '/login',
        templateUrl: 'templates/login.html',
        controller: 'LoginController'
      })
      .state('dashboard', {
        url: '/dashboard',
        templateUrl: 'templates/dashboard.html',
        controller: 'DashboardController'
      })
      .state('exercise', {
        url: '/exercise',
        templateUrl: 'templates/exercises.html',
        controller: 'ExerciseController'
      })
      .state('newExercise',{
        url: '/newExercise',
        templateUrl: 'templates/newExercise.html',
        controller: 'NewExerciseController'
      });
    $urlRouterProvider.otherwise('/');
  });
  </code></pre>