title: Pass scope of one controller to another in AngularJS
body: <p>When I click a button in <code>myCtrl</code> controller. The <code>ng-model</code> of <code>myCtrl2</code> should also be changed with <code>ng-model</code> of current controller:</p>
  
  <pre><code>&lt;div ng-app="myApp" &gt;
  &lt;div  ng-controller="myCtrl"&gt;
       &lt;input type="text" ng-model="name"&gt;
       &lt;button ng-click="just()"&gt;submit&lt;/button&gt;
  &lt;/div&gt;
  &lt;div  ng-controller="myCtrl2"&gt;
      &lt;input type="text" ng-model="name2"&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  
  &lt;script&gt;
  var app = angular.module('myApp', []);
  app.controller('myCtrl', function($scope) {
      $scope.name="before";
      $scope.just = function()
      {
         $scope.name="after";
  
         $scope.name2="after";   /////  this is not working
  
  
      }
  });
  &lt;/script&gt;
  </code></pre>