title: Error Called a function from a directive inside a function in a Controller
body: <p>I Have two controllers where i do almost the same thing, only change a little things in them, I have this:</p>
  
  <pre><code>app.controller('CreateSignerCtrl', ['$scope','SweetAlert','SignerResource','$http', '$location', '$routeParams','$timeout','ngDialog', function ($scope, SweetAlert, SignerResource, $http, $location, $routeParams, $timeout,ngDialog) {
              $scope.title = "Add Signer";
              $scope.button = "Save";
              $scope.Signer = {};
              $scope.cancel = ngDialog.closeAll;
  
              $scope.saveSigner = function() {
                  SignerResource.save($scope.Signer);
                  $.notify({
                      title: '&lt;strong&gt;Data Updated! &lt;/strong&gt;',
                      message: 'Signer Updated.'
                  },{
                      type: 'success',
                      placement: {
                          from: 'bottom',
                          align: 'right'
                      },
                      animate: {
                          enter: 'animated fadeInDown',
                          exit: 'animated fadeOutUp'
                      }
                  });
                  ngDialog.closeAll();
                  $scope.getModelData();
              };
              $scope.save = $scope.saveSigner;
          }]);
  </code></pre>
  
  <p>In this controller when i called the function <em>$scope.saveSigner</em> i receive this error:</p>
  
  <pre><code>TypeError: $scope.getModelData is not a function
  </code></pre>
  
  <p>And in this Controller:</p>
  
  <pre><code>app.controller('EditSignerCtrl', ['$scope','SweetAlert','SignerResource','$http', '$location', '$routeParams','$timeout','ngDialog', function ($scope, SweetAlert, SignerResource, $http, $location, $routeParams, $timeout,ngDialog) {
          $scope.title = "Edit Signer";
          $scope.button = "Update";
          $scope.Signer = SignerResource.get({
              id: $scope.signerId
          });
          $scope.cancel = ngDialog.closeAll;
  
          $scope.updateSigner = function() {
              SignerResource.update($scope.Signer);
              $.notify({
                  title: '&lt;strong&gt;Data Updated! &lt;/strong&gt;',
                  message: 'Signer Updated.'
              },{
                  type: 'success',
                  placement: {
                      from: 'bottom',
                      align: 'right'
                  },
                  animate: {
                      enter: 'animated fadeInDown',
                      exit: 'animated fadeOutUp'
                  }
              });
              ngDialog.closeAll();
              $scope.getModelData();
          };
  
          $scope.save = $scope.updateSigner;
      }]);
  </code></pre>
  
  <p>In this controller all is executed fine and <em>$scope.getModelData</em> do not send me any error.</p>
  
  <p>The Directive is this:</p>
  
  <pre><code>app.directive('datapaginator', function() {
    return {
      url: '=a',
      controller: function($scope, $http) {
  
          $scope.model = [];
  
          $scope.getModelData = function() {
              $http({
                  url: $scope.url,
                  method: "GET",
                  params: {page:  $scope.currentpage || 1}
              }).success(function(data, status, headers, config) {
                  if($scope.currentpage &gt; data.last_page){
                      $scope.currentpage = data.last_page;
                      $scope.getModelData();
                  }
                  $scope.currentpage = data.current_page;
                  $scope.lastpage = data.last_page;
                  $scope.generatePages(data.last_page);
                  $scope.model = data.data;
              }).error(function(response) {
                  $scope.model = response.error;
              });
          };
  });
  </code></pre>
  
  <p>That function (<em>$scope.getModelData</em>) is executed many time in other controller and is executed without problem.</p>