angular.injector
ng
Creates an injector function that can be used for retrieving services as well as for dependency injection (see dependency injection).
angular.injector(modules);
Param | Type | Details |
---|---|---|
modules | Array.<string|Function> | A list of module functions or their aliases. See
|
function() | Injector function. See |
Typical usage
// create an injector var $injector = angular.injector(['ng']); // use the injector to kick off your application // use the type inference to auto inject arguments, or use implicit injection $injector.invoke(function($rootScope, $compile, $document){ $compile($document)($rootScope); $rootScope.$digest(); });