Explain please AngularJS $injector with a clear example [closed]

There is one injector per Angular application. Normally you don’t need to interact with it directly. The injector is key to making dependency injection work in Angular.

Module methods such as factory, service, directive, etc. register these items with the injector. When you inject something (e.g., a service into a controller), the injector will lookup and then instantiate the service (if it wasn’t instantiated already — if it was, it will return the already-instantiated object).

If for some reason you really needed to dynamically inject a service into, say, a controller, see https://stackoverflow.com/a/14418384/215945 for an example of how to do that.
See also https://stackoverflow.com/a/14743553/215945.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)