title: angularjs, coding style, use of global variable
body: <p>I see a lot of Angular codes more like this. 
  The following one is from their tutorial.</p>
  
  <pre><code>angular.module('phonecat', ['phonecatFilters', 'phonecatServices']).
    config(['$routeProvider', function($routeProvider) {
    $routeProvider.
        when('/phones', {templateUrl: 'partials/phone-list.html',   controller: PhoneListCtrl}).
        when('/phones/:phoneId', {templateUrl: 'partials/phone-detail.html', controller: PhoneDetailCtrl}).
        otherwise({redirectTo: '/phones'});
  }]);
  </code></pre>
  
  <p>However, I am more familiar with like this;</p>
  
  <pre><code>var app = angular.module('phonecat', ['phonecatFilters', 'phonecatServices']);
  app.config(function($routeProvider) {
    $routeProvider.
        when('/phones', {templateUrl: 'partials/phone-list.html',   controller: PhoneListCtrl}).
        when('/phones/:phoneId', {templateUrl: 'partials/phone-detail.html', controller: PhoneDetailCtrl}).
        otherwise({redirectTo: '/phones'});
  }]);
  </code></pre>
  
  <p>I even want to define that <code>function($routeProvider) { ...}</code> as a variable, but I am not confident about that will work.</p>
  
  <p>Is there a reason behind this to avoid global variable, in this case <code>app</code>.</p>
  
  <p>Or it's just one of best practices in AngularJs community?</p>