title: AngularJS: How do I create controllers in multiple files
body: <p>I'm trying to split my controllers into multiple files, but when i try to register them at my module im getting an error:</p>
  
  <p><strong>groupcontroller.coffee</strong></p>
  
  <pre><code>app = angular.module('WebChat', []);
  app.controller 'GroupController', ($scope) -&gt; 
  </code></pre>
  
  <p><strong>usercontroller.coffee</strong></p>
  
  <pre><code>app = angular.module('WebChat', []);
  app.controller 'UserController', ($scope) -&gt; 
  </code></pre>
  
  <p><strong>Error</strong></p>
  
  <p>Error: Argument 'GroupController' is not a function, got undefined</p>
  
  <p>From the documentation I dont really get what the module method does anyway. Does it store my controller with the key 'Webchat'?</p>
  
  <p><strong>Edit:</strong>
  It also seems that passing [] creates a new module and overwrites the previous one</p>
  
  <pre><code>app = angular.module('WebChat', []);
  </code></pre>
  
  <p>To prevent this, you have to leave out the [] like</p>
  
  <pre><code>app = angular.module('WebChat');
  </code></pre>