function AnswerCtrl($scope, $http, $location) {
 
 if(parseInt(localStorage.isAnswer) == 1){//answer
   //solo lo programamos si hay dailies pendientes
   if(howMany() > 0)  {randomMomentTomorrow();}
   
   $scope.daily = JSON.parse( localStorage.dailyAlarm );
   var randNumber = Math.floor( Math.random() * $scope.daily.contexts.length );
   $scope.context = $scope.daily.contexts[ randNumber ];
   
 }
 else if(parseInt(localStorage.isAnswer) == 0){ //review
   var dailiesWithError = getDailiesToReview();
   var rand = Math.floor( Math.random() * dailiesWithError.length );
   var dailyToReview = dailiesWithError[rand];

   $scope.daily = dailyToReview;
   var randNumber = Math.floor( Math.random() * $scope.daily.contexts.length );
   $scope.context = $scope.daily.contexts[ randNumber ];
 }

 $scope.userResponse = '';

 $scope.setResponse = function() {

    $scope.userResponse = $.trim($scope.userResponse);
    $scope.userResponse = trimDoubleSpace($scope.userResponse);
    $scope.userResponse = replaceAll($scope.userResponse, "'", "’");
    var idDaily = $scope.daily.id;
    var tokenUser = localStorage.userToken;
   
    
    localStorage.userAnswer = $scope.userResponse;
    localStorage.validAnswer = getValidAnswer($scope.context);
    
    if( validateAnswer($scope.userResponse, $scope.context) ){
      updateStatusDaily($scope.daily.id, 1);
      $location.path("ok");
    }else{
     updateStatusDaily($scope.daily.id, 0);
     $location.path("bad");
    }
  
 }
 sizeBoxContext();
}


