Skip to content

Latest commit

 

History

History
25 lines (21 loc) · 703 Bytes

README.md

File metadata and controls

25 lines (21 loc) · 703 Bytes

angular-namespacer

Namespaces your Angular modules!

Angular Namespacer essentially hacks angular.module and renames your Providers on the fly by concatenating the module name and provider name together. In order for this to effectively work, you must take advantage of the minification features.

angular.module('util', [])
  .namespace(true)
    .factory('thing', function() {
      return 1 + 2;
    });

angular.module('myApp', ['util'])
  .controller('MainCtrl', [
    // dependencies
    '$scope',
    'util.thing',
    // give your provider a fancy alias!
    function($scope, superAmazingThing) {
      $scope.sweetData = superAmazingThing;
    }
  ]);