title: Use data from input controller in other, output controller
body: <p>I am trying to use data from one controller in another one. Which is the best way to achieve this? </p>
  
  <p>I have input and output controllers and their views: </p>
  
  <p>Input controller:</p>
  
  <pre><code>AppControllers.controller('DateCtrl', [
    '$scope','$http',
    function($scope, $http){
      $http.get('/dates').then(function(response){
        $scope.years = response.data.years
        $scope.months = []
        for (var i = 0; i &lt; 12; i++) {
          $scope.months.push(response.data.months[i])
        }
      })
    }
  ]);
  </code></pre>
  
  <p>Input view:</p>
  
  <pre><code>  &lt;div class="input-dual" ng-controller="DateCtrl"&gt;
      &lt;div class="input-dual-inner"&gt;
        &lt;span&gt;Datum polaska:&lt;/span&gt;
        &lt;select ng-model="selectedYear" ng-options="year as year for year in years"&gt;
        &lt;/select&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  </code></pre>
  
  <p>Output controller:</p>
  
  <pre><code>AppControllers.controller('DataOutput', [
    '$scope','$http',
     function($scope, $http){
  
     }
  ]);
  </code></pre>
  
  <p>Output view:</p>
  
  <pre><code>  &lt;div ng-controller="DataOutput"&gt;
      {{ selectedYear }}
    &lt;/div&gt;
  </code></pre>