title: Why are there 2 different angular function wrapping approaches and which one is best.?
body: <p>So I'm new to javascript and angularjs. But something that keeps me confusing is this.</p>
  
  <p>Function A</p>
  
  <pre><code>(function (angular) {
  
      var AuthenticationService = function($http, $cookieStore, $rootScope, $timeout,UserService) {
  
      }
  
      AuthenticationService.$inject = ['$http', '$cookieStore', '$rootScope', '$timeout','UserService'];
      angular.module("app.AuthenticationService").factory("AuthenticationService", AuthenticationService);
  
  })(angular);
  </code></pre>
  
  <p>I started some test examples with this one and in know in app.js i need to do something like this:</p>
  
  <pre><code>(function(angular) {        
      angular.module("app.AuthenticationService", ['ngCookies']);
      angular.module("app", ['ngRoute','ngResource',"app.AuthenticationService"]);
  }(angular));
  </code></pre>
  
  <p>Function B</p>
  
  <pre><code>(function () {
      'use strict';
  
      angular
          .module('app')
          .factory('AuthenticationService', AuthenticationService);
  
      AuthenticationService.$inject = ['$http', '$cookieStore', '$rootScope', '$timeout', 'UserService'];
      function AuthenticationService($http, $cookieStore, $rootScope, $timeout, UserService) {
  
      }
  
  })();
  </code></pre>
  
  <p>Now i haven't practical with Function B approach but i get confused on which is a better practical way and why?</p>