title: Error: [ng:areq] Argument 'module' is not a function, got Object
body: <p>I try to use <a href="https://github.com/danialfarid/ng-file-upload" rel="noreferrer">angular uploader</a> which download it using npm and later browserify it all in single file. The error details can be seen <a href="https://docs.angularjs.org/error/$injector/modulerr?p0=jobApp&amp;p1=Error:%20%5Bng:areq%5D%20Argument%20%27fn%27%20is%20not%20a%20function,%20got%20Object%0Ahttp:%2F%2Ferrors.angularjs.org%2F1.4.0%2Fng%2Fareq%3Fp0%3Dfn%26p1%3Dnot%2520a%2520function%252C%2520got%2520Object%0A%20%20%20%20at%20REGEX_STRING_REGEXP%20(http:%2F%2Flocalhost:8000%2Fjs%2Fbundle.js:18051:12)%0A%20%20%20%20at%20assertArg%20(http:%2F%2Flocalhost:8000%2Fjs%2Fbundle.js:19748:11)%0A%20%20%20%20at%20assertArgFn%20(http:%2F%2Flocalhost:8000%2Fjs%2Fbundle.js:19758:3)%0A%20%20%20%20at%20Function.annotate%20(http:%2F%2Flocalhost:8000%2Fjs%2Fbundle.js:21694:5)%0A%20%20%20%20at%20Object.invoke%20(http:%2F%2Flocalhost:8000%2Fjs%2Fbundle.js:22387:36)%0A%20%20%20%20at%20runInvokeQueue%20(http:%2F%2Flocalhost:8000%2Fjs%2Fbundle.js:22315:35)%0A%20%20%20%20at%20http:%2F%2Flocalhost:8000%2Fjs%2Fbundle.js:22324:11%0A%20%20%20%20at%20forEach%20(http:%2F%2Flocalhost:8000%2Fjs%2Fbundle.js:18319:20)%0A%20%20%20%20at%20loadModules%20(http:%2F%2Flocalhost:8000%2Fjs%2Fbundle.js:22305:5)%0A%20%20%20%20at%20createInjector%20(http:%2F%2Flocalhost:8000%2Fjs%2Fbundle.js:22231:11" rel="noreferrer">here</a></p>
  
  <p>I cannot understand the errors because now I'm still new to AngularJS. Here is my code</p>
  
  <pre><code>var angular = require('angular');
  angular
      .module('jobApp', [require('angular-material'), require('ng-file-upload')])
      .controller('MainCtrl', ['$rootScope', '$scope', '$mdToast', '$animate', '$http', '$timeout', '$q', '$log', 'Upload',
          function($rootScope, $scope, $mdToast, $animate, $http, $timeout, $q, $log, Upload) {
          'use strict';
          // Initialize the scope variables
          $scope.$watch('files', function () {
              $scope.upload($scope.files);
          });
          $scope.upload = function (files) {
              if (files &amp;&amp; files.length) {
                  for (var i = 0; i &lt; files.length; i++) {
                      var file = files[i];
                      Upload.upload({
                          url: 'http://sr-recruit.herokuapp.com/resumes',
                          fields: {
                              'name': $scope.name,
                              'email': $scope.email,
                              'about': $scope.about
                          },
                          file: file
                      }).progress(function (evt) {
                          var progressPercentage = parseInt(100.0 * evt.loaded / evt.total);
                          $scope.log = 'progress: ' + progressPercentage + '% ' +
                                      evt.config.file.name + '\n' + $scope.log;
                      }).success(function (data, status, headers, config) {
                          $scope.log = 'file ' + config.file.name + 'uploaded. Response: ' + JSON.stringify(data) + '\n' + $scope.log;
                          $scope.$apply();
                      });
                  }
              }
          };
      }]);
  </code></pre>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Now am using Browserify-shim to properly enclosed the Angular-file-upload in Commonjs format. Thanks to @ryan Johnson.</p>
  
  <p>Here is the package.json</p>
  
  <pre><code>{
      "browser": {
          "angular": "./node_modules/angular/angular.js",
          "ng-file-upload": "./node_modules/ng-file-upload/dist/ng-file-upload-all.js"
      },
      "browserify-shim": {
          "angular": {
              "exports": "angular"
          },      
          "ng-file-upload": {
              "exports": "angular.module('ngFileUpload').name"
          }
      },
      "browserify": {
          "transform": [
              "browserify-shim"
          ]
      }
  }
  </code></pre>
  
  <p>I still the error</p>
  
  <pre><code>TypeError: Cannot read property '' of undefined
  </code></pre>
  
  <p>Not sure why. FYI I use Laravel-elixir built in browserify to run the task.</p>