title: Are controllers mandatory for writing directives
body: <p>I'm just a beginner in angular JS. I'm learning to a write a directive.</p>
  
  <pre><code>&lt;!DOCTYPE&gt;
  &lt;html ng-app="myapp"&gt;
  &lt;head&gt;
  &lt;script src="angular.min.js"/&gt;
  &lt;script&gt;
  var app = angular.module('myapp', []);
  
  app.directive('helloWorld',function()
  {
  return{
  restrict: 'AEC',
  replace: 'true',
  template: '&lt;h1&gt;helloWorld&lt;/h1&gt;' 
  }
  });
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;h1&gt;Hello World example&lt;/h1&gt;
  &lt;hello-world&gt;&lt;/hello-world&gt;
  &lt;/body&gt;
  &lt;/html&gt;  
  </code></pre>
  
  <p>Now, what is wrong in the above code, I get an error - <strong>Uncaught Error: [$injector:modulerr]</strong>.<br>
  1. Is controller mandatory to write a directive, does it not inherit from $rootscope.<br>
  2. How can I master directives. </p>