klei / gulp-angular-filesort

Automatically sort AngularJS app files depending on module definitions and usage
MIT License
132 stars 46 forks source link

Modules within closures #42

Open brunofin opened 8 years ago

brunofin commented 8 years ago

Hello, first I want to say thanks for such awesome plugin.

I want to ask whether will it work correctly for modules that are created within JS closures. I tend to keep this pattern for my Angular modules, for example:

(function(angular) {
  var app = angular.module('dgDAO', []);

  app.service('API', ['$http', function($http) {
    /* Base API service */
    var API = {
      baseURL: '/api',
      describeAPI: function() {
        return $http({
          method: 'OPTIONS',
          url: API.baseURL
        })
      }
    }
    return API;
  }]);
})(window.angular);

Will it work with such module?

joakimbeng commented 8 years ago

I do think so, but haven't tried it myself