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