Last active
August 29, 2015 14:03
-
-
Save dburrows/71c5cdbe696665ce5b4a to your computer and use it in GitHub Desktop.
Minification issues with Angular & Browserify
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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