title: AngularJS watch an object property in an object array
body: <p>I have this <code>data</code> in my controller</p>
  
  <pre><code>    $scope.data = {
          home: {
              baseValue: "1",
              name: "home"
          },
          contact: {
              baseValue: "2",
              name: "contract"
          }
       // a lot more options
      };
  </code></pre>
  
  <p>with some html like this:</p>
  
  <pre><code>&lt;section class="content row" ng-repeat="item in data"&gt;
     {{item.name}}
     ....
  &lt;/section&gt;
  </code></pre>
  
  <p>Now, I want to know when the <code>baseValue</code> is changed but because of I using a objects inside the data variable I can not <code>watch</code> the property in a simpler way.</p>
  
  <p>I have tried something like this, but I have to loop all the array</p>
  
  <pre><code>$scope.$watch('data', function (newValue, oldValue, scope) {
   // some code to compare the tow arrays, line by line
  }, true);
  </code></pre>
  
  <p>How can I do a simpler <code>$watch</code> to know only when the <code>baseValue</code> is changed?</p>
  
  <p>Similar questions:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/17417597/angularjs-watch-array-of-objects-for-data-change">AngularJS watch array of objects for data change</a></li>
  <li><a href="https://stackoverflow.com/questions/16123120/how-to-get-an-object-that-was-changed-in-angularjs">How to get an object that was changed in angularjs?</a></li>
  <li><a href="https://stackoverflow.com/questions/14712089/how-to-deep-watch-an-array-in-angularjs">How to deep watch an array in angularjs?</a></li>
  </ul>
  
  <p><strong>UPDATE</strong> 1</p>
  
  <p>I could add an individual watch for each object to know when the <code>baseValue</code> is changed, but it won't be nice if I had an <code>n</code> number of objects, not only a couple of objects like in this example</p>
  
  <pre><code>$scope.$watch('data.home', function (newValue, oldValue, scope) {
   // do some stuff with newvalue.baseValue
  }, true);
  
  $scope.$watch('data.contact', function (newValue, oldValue, scope) {
   // do some stuff with newvalue.baseValue
  }, true);
  ... // Adds more individual `watch`
  </code></pre>