My Angular app only works with a certain syntax
<p>I'm following a thinkster tutorial on angular and rails. The tutorials says to make the app like this...</p>

<p><code>angular.module('flapperNews', [])</code></p>

<p>with the controllers and factories like this...</p>

<p><code>.config([...
 .controller([...
 .factory([...
</code></p>

<p>and so on. However it only works when I do this...</p>

<p><code>var flapperNews = angular.module('flapperNews', [])</code></p>

<p>with the controllers and factories like this...</p>

<p><code>flapperNews.config([...
 flapperNews.controller([...
 flapperNews.factory([...
</code></p>

<p>Is there a short answer for this? Is the tut wrong or am I doing something wrong.
Here is the tut link 
<a href="https://thinkster.io/angular-rails#introduction" rel="nofollow">https://thinkster.io/angular-rails#introduction</a></p>

<p>I haven't started the rails part yet, just wanted to know why it breaks.</p>

<p>Here are the two codepens... 
This one works as described above.
<a href="http://codepen.io/MrNagoo/pen/regKgM" rel="nofollow">http://codepen.io/MrNagoo/pen/regKgM</a></p>

<p>This one fails and gives errors, although it's how i'm being directed to write the code...</p>

<p><a href="http://codepen.io/MrNagoo/pen/regKEM" rel="nofollow">http://codepen.io/MrNagoo/pen/regKEM</a></p>