title: How to inject '$modalInstance' into a controller?
body: <p>In my application after I found out that a user is not logged in I want to open a modal dialog: </p>
  
  <pre><code>  .when('/showtask/:id', {templateUrl: 'Home/Template/showtask', resolve: ShowTaskCtrl.resolve, access: { allowAnonymous: false },
              resolve: {
          userAuthenticated: ["$http", "$q", function ($http, $q) {
              var deferred = $q.defer();
              $http.get('/api/Authentication/UserAuthenticated').then(function (data) {
  
                  if (data.data != "null") {
                      deferred.resolve(data.data);
                  }
                  else {
  
                      var modalInstance = {
                          templateUrl: 'Home/Template/loginfailed',
                          controller: 'ModalInstanceCtrl',
                          modalpart: ['modalpart', function (modalpart) {
                              return modalInstance;
                              }]
                      };
                      $modal.open(modalInstance);
  
                      deferred.reject();
  
                  }   
              });
              return deferred.promise;
  
          }]
  
      }
  </code></pre>
  
  <p>Since it is happening on route change I have to inject a modalpart inside an instance and retrieve it in the controller. </p>
  
  <pre><code>var ModalInstanceCtrl = WorkerApp.controller('ModalInstanceCtrl', ["$scope", "modalpart", function ($scope, modalpart) {
  </code></pre>
  
  <p>But I keep getting this error: </p>
  
  <blockquote>
    <p>Unknown provider: modalpartProvider &lt;- modalpart</p>
  </blockquote>
  
  <p>How can I solve this problem? </p>
  
  <p>P.S. Original code which I am looking at is here: <a href="http://angular-ui.github.io/bootstrap/" rel="nofollow noreferrer">http://angular-ui.github.io/bootstrap/</a> (under modal)</p>