title: AngularJS. Adding $watch to the particular model
body: <p>I am new to angularJS and i don't know how to add <code>$watch</code> to the particular model. When going through the angularjs tutorial I am facing some issue. I mentioned my doubt in comments part. please go through this.</p>
  
  <pre><code>(function(angular) {
  angular.module('controllerAsExample', [])
    .controller('SettingsController1', SettingsController1);
  
  function SettingsController1() {
    this.name = "John Smith";
    this.contacts = [
      {type: 'phone', value: '408 555 1212'},
      {type: 'email', value: 'john.smith@example.org'} ];
  }
  //how to add $watch to ng-model 'settings.name' 
  /*$scope.$watch("settings.name", function(oldval, newval){
    console.log(oldval + "  + " + newval);
  });*/
  
  SettingsController1.prototype.greet = function() {
    console.log(this.name);
  };
  
  
  })(window.angular);
  </code></pre>
  
  <p>HTML code..</p>
  
  <pre><code>&lt;body ng-app="controllerAsExample"&gt;
    &lt;div id="ctrl-as-exmpl" ng-controller="SettingsController1 as settings"&gt;
      &lt;label&gt;Name: &lt;input type="text" ng-model="settings.name"/&gt;&lt;/label&gt;
      &lt;button ng-click="settings.greet()"&gt;greet&lt;/button&gt;&lt;br/&gt;
    &lt;/div&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>Here check my <a href="http://plnkr.co/edit/3YJCsuOcLpoFAgipmus8?p=preview" rel="nofollow">link</a></p>