title: Getting the updated $scope in a $timeout in ui-router
body: <p>This question might best be served by showing 2 JSFiddles examples (issue occurs in the 2nd JSFiddle link).</p>
  
  <p>So I was playing with an example in Angular where I go through questions in my app, and when you get to a certain question called 'QS_SEARCH', then it autosubmits the question after 3 seconds.
  I added some simple functionality so pretend now you are on the last question 'QS_SUCCESS' and if you clicked back to the 'QS_SEARCH' question, then the autosubmit timeout now gets initiated again... but if you click Back one more time quickly before the $timeout func runs, then when function executes it realizes the user isn't on 'QS_SEARCH' anymore and doesn't autosubmit. This is working correctly.
  <a href="http://jsfiddle.net/armyofda12mnkeys/wxLqv4cs/" rel="nofollow">http://jsfiddle.net/armyofda12mnkeys/wxLqv4cs/</a></p>
  
  <p>Now the same example with ui-router seems to hold the old $scope value and will still autosubmit even if you clicked Back to 'QS3' pretend, which is incorrect.
  How can the $timeout get the updated scope so it doesn't autosubmit when you aren't on that specific question? I even tried $scope.$apply() inside the $timeout function but it still doesn't get the latest value.
  <a href="http://jsfiddle.net/armyofda12mnkeys/qrp6cjgv/" rel="nofollow">http://jsfiddle.net/armyofda12mnkeys/qrp6cjgv/</a></p>
  
  <p>Is this a Closure issue? I thought though $scope would be updated though.</p>
  
  <p>Here is code for the $timeout:</p>
  
  <pre><code>   if($scope.currentquestion.qid == 'QS_SEARCH') {
              console.log('TIMEOUT: FUNC WILL START IN 3s');
              $timeout(function(){
                //$scope.$apply(); //update current question, not working though
                console.log('3S DONE: FUNC EXECUTING');
                console.log('current question is:'+ $scope.currentquestion.qid); 
                if( $scope.currentquestion.qid=='QS_SEARCH' ) {//double-check to make sure stilll on this question!!! (where issue occurs)
                  console.log('STILL on QS_SEARCH so autosubmit!');
                  $scope.getnextquestion();
                }
              }, 3000);
  
          }          
  </code></pre>