title: How to find out if variable value has changed? (angularJS)
body: <p>In HTML I have this:</p>
  
  <pre><code>&lt;input id="Search" type="text" placeholder="Search Images.." ng-model="data" 
         ng-keypress="($event.charCode==13)? searchMore() : return"&gt;
  </code></pre>
  
  <p>This is basically input field which acts as search.</p>
  
  <p>In controller I just receive the value which is passed to input: <code>$scope.data</code></p>
  
  <p>I want to determine somehow if the search term has changed so that I can wipe out results array if it did or append if just more results of the same search term came.</p>
  
  <p>How to determine that <code>$scope.data</code> now contains a different string? If I will just set something like this:</p>
  
  <pre><code>$scope.savedData = $scope.data 
  </code></pre>
  
  <p>This new variable will be overwritten all the time with new data.</p>