title: Inject module dependency (like plugin) only if needed AngularJS
body: <p>I have 2 pages (I don't use the <code>angular</code>'s <code>routing</code> - This constraint).</p>
  
  <p>In one of them I want to use the directive <a href="http://ui-grid.info/docs/#/tutorial/101_intro" rel="noreferrer"><code>ui-grid</code></a> like in this demo:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var app = angular.module('myApp', ['ui.grid']);
  app.controller('mainCtrl', function($scope) {
    $scope.myData = [
      {
          "firstName": "Cox",
          "lastName": "Carney",
          "company": "Enormo",
          "employed": true
      },
      {
          "firstName": "Lorraine",
          "lastName": "Wise",
          "company": "Comveyer",
          "employed": false
      },
      {
          "firstName": "Nancy",
          "lastName": "Waters",
          "company": "Fuelton",
          "employed": false
      }
    ];
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.js"&gt;&lt;/script&gt;
  &lt;script src="http://ui-grid.info/release/ui-grid-unstable.js"&gt;&lt;/script&gt;
  &lt;link rel="stylesheet" href="http://ui-grid.info/release/ui-grid-unstable.css" type="text/css"&gt;
  
  &lt;div ng-app="myApp"&gt;
    &lt;div ng-controller="mainCtrl"&gt;
      &lt;div id="grid1" ui-grid="{ data: myData }" class="grid"&gt;&lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>My question is if there is a way to not inject the <code>ui-grid</code> dependency to the app in any case but only when I need it.</p>
  
  <p>Something like:</p>
  
  <pre><code>app.controller('mainCtrl', function($scope) {
     app.$inject('ui-grid');
  });
  </code></pre>
  
  <p><strong>Update</strong></p>
  
  <p>I tried to do:</p>
  
  <pre><code>var ui_grid = $injector.get('ui-grid');
  </code></pre>
  
  <p>But I've got an error:</p>
  
  <blockquote>
    <p>Unknown provider: ui-gridProvider &lt;- ui-grid</p>
    
    <p><a href="http://errors.angularjs.org/1.2.26/$injector/unpr?p0=ui-gridProvider%20%3C-%20ui-grid" rel="noreferrer">http://errors.angularjs.org/1.2.26/$injector/unpr?p0=ui-gridProvider%20%3C-%20ui-grid</a></p>
  </blockquote>