title: Change variable when a model is changed
body: <p>I have two models, one for each input field. I have a controller that outputs data. Inside that controller I defined new variable that merges these two input models. However that variable doesn't change upon model changes. How do I update that variable when one of models change?</p>
  
  <p>This is part of my global controller:</p>
  
  <pre><code>$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>This is view with model that I want to watch:</p>
  
  <pre><code>  &lt;div class="input-dual"&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 class="input-dual-inner"&gt;
        &lt;span style="opacity: 0; cursor: default"&gt;.&lt;/span&gt;
        &lt;select ng-model='selectedMonth' ng-options='month as month.name for month in months'&gt;
        &lt;/select&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  </code></pre>
  
  <p>And this is controller that should watch for changes and assign new model:</p>
  
  <pre><code>AppControllers.controller('DataOutput', [
    '$scope','$http',
     function($scope, $http){
       $scope.selectedDate = $scope.selectedYear + "-" + $scope.selectedMonth
     }
  ]);
  </code></pre>