title: Angularjs "Controller as" or "$scope"
body: <p>I would like to know what is the main difference between "Controller as" or "$scope" syntax in angularjs.</p>
  
  <ol>
  <li>Do they have any performance impact,if yes which syntax is preferable.</li>
  <li>"Controller as" syntax surely improve the readability of the code,as Knockout.js and other JavaScript framework follows the same syntax.</li>
  <li><p>$scope will provide scope inheritance which sometimes give us weird behavior like</p>
  
  <pre><code>&lt;div ng-controller="firstController"&gt;
   ParentController: &lt;input type="text" ng-model="parent"/&gt;
    &lt;div ng-controller="secondController"&gt;
      ChildController: &lt;input type="text" ng-model="parent" /&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  
  app.controller('ParentController', function ($scope) {
    $scope.parent = "parentScope";
  }).controller('ChildController', function ($scope) { /*empty*/ }); 
  </code></pre>
  
  <p>a) Initially child will get the parent property and it displays 'parentScope' when we update parent child will also get updated. But if we have changed the child property now updating the parent doesn't modify child as it has got its own scope property.</p>
  
  <p>b) If i am using controller as syntax changing child also updates the parent. </p></li>
  </ol>