title: Unable to use $compile in AngularJS
body: <p>I'm working on an AngularJS app that uses a custom directive. I'm also trying to use unit testing in my app. So, I'm trying to leverage Jasmine for that. Currently, My unit test is the problem. Currently, it looks like the following:</p>
  
  <p><strong>myDirective.spec.js</strong></p>
  
  <pre><code>describe('Directive: myDirective', function () {
    describe('Function: myProcedure', function () {
      it('should word', function ($rootScope, $compile) {     
        var e = angular.element('&lt;div&gt;&lt;br /&gt;&lt;/div&gt;');
      console.log($compile);
        $compile(e)($rootScope);
  
        expect(true).toBe(true);
      });
    });
  });
  </code></pre>
  
  <p>This test is throwing an exception. When the console.log line is ran, it prints: 'undefined'. The next line throws an error to Jasmine that says: 'TypeError: undefined is not a function'.</p>
  
  <p>Its like I'm not injecting the $compile service. However, I believe I'm doing so. My test runner looks like the following:</p>
  
  <pre><code>&lt;html ng-app="testApp"&gt;
  &lt;head&gt;
      &lt;title&gt;&lt;/title&gt;
  
      &lt;script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.min.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jasmine/2.0.0/jasmine.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jasmine/2.0.0/jasmine-html.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jasmine/2.0.0/boot.js"&gt;&lt;/script&gt;
  
      &lt;script type="text/javascript" src="index.html.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="directives/myDirective.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="tests/unit/myDirective.spec.js"&gt;&lt;/script&gt;
  
      &lt;link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/jasmine/2.0.0/jasmine.css" /&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  
      &lt;a href="#" onclick="env.execute()"&gt;run tests&lt;/a&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Why cannot I not run this basic test? What am I doing wrong?</p>