title: AngularJs $watchGroup - which expression in the group was last changed?
body: <p>Using <code>$watchGroup</code>, how can I determine which expression in the group was changed</p>
  
  <pre><code>    $scope.$watchGroup(['dec','bin','oct','hex'], function(newValues, oldValues, scope) {
         last_changed = ??? //return which exp was changed in this run...
         if(last_changed=='dec') //then something
         if(last_changed=='bin') //then something
         if(last_changed=='oct') //then something
         if(last_changed=='hex') //then something
      });
  </code></pre>
  
  <p><br>
  Edit 1:-
  <br>--->the problem is i can't unbind the n_vals from the newValues.</p>
  
  <pre><code>var n_vals = [];
   $scope.$watchGroup(['dec','bin','oct','hex'], function(newValues, oldValues, scope) {
    last_updated = changed_one(newValues,n_vals); //last_updated EXP
      n_vals = newValues;
   });
  </code></pre>
  
  <h1>Solution:-</h1>
  
  <pre><code>n_vals = angular.copy(newValues);
  </code></pre>
  
  <p>look the following link:<br>
  <a href="https://stackoverflow.com/questions/14360401/deep-copying-objects-in-angular">Deep copying objects in angular?</a></p>