title: How to call controller function from directive?
body: <p>how to call controller function from directive? or howto access directive ng-model from controller?
  eg. I use angular ui bootstrap time component and when time change I need to notify calling function in controller. 
  I think in general it's typical use case for two way communication between components.</p>
  
  <pre><code>appControllers.controller('mainCtrl', ['$scope', 
    function($scope) {
  
      $scope.changedTime = function(time) {
          alert(time);        
      }
  
   }]).directive('timePicker',['$http', function($http) {
    return {
      restrict: 'AE',    
      templateUrl: 'partials/time-picker.html',
      scope: true,
      controller: 'TimepickerDemoCtrl'        
    };
  }]);
  
  
  //partials/time-picker.html:
  &lt;span ng-controller="TimepickerDemoCtrl"&gt;              
     &lt;timepicker ng-model="mytime" ng-change="changed()" hour-step="hstep" minute-step="mstep" show-meridian="ismeridian"&gt;&lt;/timepicker&gt;              
  &lt;/span&gt;
  
  
  //TimepickerDemoCtrl (copy from source):
  var TimepickerDemoCtrl = function ($scope) {
    $scope.mytime = new Date();
    $scope.hstep = 1;
    $scope.mstep = 15;
  
    $scope.options = {
      hstep: [1, 2, 3],
      mstep: [1, 5, 10, 15, 25, 30]
    };
  
    $scope.ismeridian = true;
    $scope.toggleMode = function() {
      $scope.ismeridian = ! $scope.ismeridian;
    };
  
    $scope.update = function() {       
      var d = new Date();
      d.setHours( 14 );
      d.setMinutes( 0 );
      $scope.mytime = d;
    };
  
    $scope.changed = function () {
      console.log('Time changed to: ' + $scope.mytime);
    };
  
  };
  </code></pre>