Skip to content

Instantly share code, notes, and snippets.

@yngvebn
Created March 28, 2014 13:05
Show Gist options
  • Save yngvebn/9832236 to your computer and use it in GitHub Desktop.
Save yngvebn/9832236 to your computer and use it in GitHub Desktop.
// 1. Breaks with minifiers - no-go
angular.module('myModule').controller('HomeCtrl', function($scope){
});
// 2. My preferred method
angular.module('myModule').controller('HomeCtrl', ['$scope', function($scope){
}]);
// 3. Don't like the extra IIFE-wrapping here, but I see the point.
(function () {
'use strict';
var controllerId = 'HomeCtrl';
angular.module('app').controller(controllerId,
['$scope', controller1]);
function controller1($scope) {
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment