ngbrowserify

Angular function-based injection to array-based injection transform for browserify and the command line.

npm install ngbrowserify
12 downloads in the last week
28 downloads in the last month

ngbrowserify

Angular function injection to array injection transform for browserify.

browserify -t ngbrowserify main.js -o main.bundle.js

Or use it from the command-line instead of ngmin:

ngbmin < input.js > output.js

example input

angular.module('m').factory('f', 
    function($rootScope, $http) {
        // code    
    });

Output:

angular.module('m').factory('f', 
    ['$rootScope', '$http', function($rootScope, $http) {
        // code    
    }]);

alternate syntax

Named function expressions that end with '$ng' will always be transformed.

var factory = function myModule$ng($scope, $http) {
};
angular.module('m').factory('f', factory);

Output:

var factory = [$scope, $http, function myModule$ng($scope, $http) {
}];
angular.module('m').factory('f', factory);

license

MIT

npm loves you