AngularJS. Adding $watch to the partiular model : I am new to angularJS and i dont know how to add `$watch` to the particular model. When going through the angularjs tutorial i facing some issue. i mentioned my doubt in comments part. please go through this.

    (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);

HTML code..

    <body ng-app="controllerAsExample">
      <div id="ctrl-as-exmpl" ng-controller="SettingsController1 as settings">
        <label>Name: <input type="text" ng-model="settings.name"/></label>
        <button ng-click="settings.greet()">greet</button><br/>
      </div>
    </body>

Here check my [link][1]
 


  [1]: http://plnkr.co/edit/3YJCsuOcLpoFAgipmus8?p=preview