title: Why is angular controller written inside (function() )()
body: <p>I have decent knowledge of angularJS. I came across some codes where the controllers are defined in this way. eg</p>
  
  <pre><code>   (function () {
         angular.module('meanApp')
        .controller('registerCtrl', registerCtrl);
        registerCtrl.$inject = ['$location', 'authentication'];
       }
  
      })();
  </code></pre>
  
  <p>I am not able to understand why is the controller designed in this way i.e : inside (function() )()?.</p>