Skip to content

Instantly share code, notes, and snippets.

@vilmosioo
Last active January 3, 2016 16:49
Show Gist options
  • Save vilmosioo/8491587 to your computer and use it in GitHub Desktop.
Save vilmosioo/8491587 to your computer and use it in GitHub Desktop.
Change component registration during configuration phase.
// Initialize your angular app module
angular.module('ngApp', [/* any other dependet modules */])
// our configuration method
.config(function($controllerProvider, $compileProvider, $filterProvider, $provide){
// Save old component registration methods (optional).
angular.module('ngApp')._controller = angular.module('ngApp').controller;
angular.module('ngApp')._service = angular.module('ngApp').service;
angular.module('ngApp')._factory = angular.module('ngApp').factory;
angular.module('ngApp')._directive = angular.module('ngApp').directive;
// Provider-based component registration.
angular.module('ngApp').controller = $controllerProvider.register;
angular.module('ngApp').service = $provide.service;
angular.module('ngApp').factory = $provide.factory;
angular.module('ngApp').directive = $compileProvider.directive;
angular.module('ngApp').filter = $filterProvider.register;
}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment