Skip to content

Instantly share code, notes, and snippets.

@dburrows
Last active August 29, 2015 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dburrows/71c5cdbe696665ce5b4a to your computer and use it in GitHub Desktop.
Save dburrows/71c5cdbe696665ce5b4a to your computer and use it in GitHub Desktop.
Minification issues with Angular & Browserify
// when using Browserify with Angular + ngmin you may do something like this
// controllers/example-list.js
module.exports = function ($scope) {
//..
};
// example-module.js
var exampleListController = require('./controllers/example-list');
module.exports = angular.module('baseApp.example',[])
.controller('exampleListController', exampleListController);
// when we uglify our files for production this will break even if though we're using ngmin
// ngmin can't see exampleListController arguments so it can't work out what to inject
// we need to manually inject dependencies
module.exports = angular.module('baseApp.example',[])
.controller('exampleListController', ['$scope', exampleListController]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment