title: angularjs: $watch two variables and do something if only one changes
body: <p>I have a situation in which I want to monitor a specific variable. </p>
  
  <pre><code>$scope.$watch('action', function() { /* do something */ }
  </code></pre>
  
  <p>However, I only want to do something if <code>$scope.id</code> didn't change (if <code>$scope.action</code> changes it is possible that <code>$scope.id</code> has changed too.)</p>
  
  <p>The only solution I can think of is</p>
  
  <pre><code>$scope.$watch('action', function() { 
      if(idHasChanhed === false){
          /* do something */ 
      }
      idHasChanged = false;
  });
  $scope.$watch('id', function() { idHasChanged = true }
  </code></pre>
  
  <p>However, I was wondering if angular has a better solution than this, and I don't know if this solution will always work ( is the order in which the $watches are executed random !?)</p>