$controller
(service in module ng
)
$controller
service is responsible for instantiating controllers.
It's just a simple call to $injector
, but extracted into
a service, so that one can override this service with BC version.
$controller(constructor, locals);
constructor – {Function|string} –
If called with a function then it's considered to be the controller constructor function. Otherwise it's considered to be a string which is used to retrieve the controller constructor using the following steps:
$controllerProvider
window[constructor]
on the global window
objectlocals – {Object} –
Injection locals for Controller.
{Object}
– Instance of given controller.