An injector is a service locator that is used to retrieve the object instances as defined by the invoke methods, provider, load modules, and instantiate types.

Note: Our aim while creating angular interview questions and answers, is to help you grow as an Angular Developer. The questions mentioned here have been asked by leading organizations during technical rounds of the interview process.

Example

                                        

var $injector = angular.injector();
expect($injector.get('$injector')).toBe($injector);
expect($injector.invoke(function($injector) {
   return $injector;
})).toBe($injector);

Suggest An Answer

No suggestions Available!