title: The correct way to inject an angular controller dependency inside an angular.ui modal
body: <p>following angular.ui Modal <a href="https://github.com/angular-ui/bootstrap/tree/master/src/modal">example</a> shows the <code>modalInstance</code> calling a <code>ModalIntanceCtrl</code> which is later created as a function:</p>
  
  <pre><code>var ModalDemoCtrl = function ($scope, $modal, $log) {
  
    $scope.items = ['item1', 'item2', 'item3'];
  
    $scope.open = function () {
  
      var modalInstance = $modal.open({
        templateUrl: 'myModalContent.html',
        controller: ModalInstanceCtrl,
        resolve: {
          items: function () {
            return $scope.items;
          }
        }
      });
  
      modalInstance.result.then(function (selectedItem) {
        $scope.selected = selectedItem;
      }, function () {
        $log.info('Modal dismissed at: ' + new Date());
      });
    };
  };
  
  var ModalInstanceCtrl = function ($scope, $modalInstance, items) {
  
    $scope.items = items;
    $scope.selected = {
      item: $scope.items[0]
    };
  
    $scope.ok = function () {
      $modalInstance.close($scope.selected.item);
    };
  
    $scope.cancel = function () {
      $modalInstance.dismiss('cancel');
    };
  };
  </code></pre>
  
  <p>I have a 2 questions/problems:</p>
  
  <ol>
  <li><p>the docs recommend creating a controller in another way (due to minification issues) for example:</p>
  
  <p><code>myApp.controller('GreetingCtrl', ['$scope', function($scope) {
      $scope.greeting = 'Hola!';
  }]);</code></p></li>
  </ol>
  
  <p>But if I create the controller like this, how could I Inject it into the modalInstance?</p>
  
  <ol>
  <li>The controller I call here isn't a Modal Instance controller but my global <code>loginCtrl</code>, is this a problem? should I subclass somehow the loginCtrl or call it from the ModalInstanceCtrl? and if so - how exactly?</li>
  </ol>
  
  <p>I'll be glad for guidance and clarfication about this.
  Thanks!</p>