January 28, 2023


The complete guide to the beginners as well as to the experienced Web Developers

AngularJS Dependency Injection

    • Service is a singleton javascript object containing a set of functions to perform certain tasks.
    • Services are defined using service() functions and then injected into controllers.

In build service

$anchorScroll: If set specifies a vertical scroll-offset. This is often used when there are fixed positioned elements at the top of the page, such as navbars, headers etc.
$animate: Service exposes a series of DOM utility methods that provide support for animation hooks.
$animateCss: Service will actually perform animations.
$casheFactory: Service that constructs Cache objects and gives access to them.
$templateCache: a Service is a Cache object created by the $cacheFactory.
$compile: Compiles an HTML string or DOM into a template and produces a template function, which can then be used to link scope and the template together.
$controller: Service is responsible for instantiating controllers. Like a constructor, locals
$document: A jQuery or jqLite wrapper for the browser’s window.document object
$exceptionHandler: Any uncaught exception in AngularJS expressions is delegated to this service. The default implementation simply delegates to $log.error which logs it into the browser console.
$filter: Filters are used for formatting data
$httpParamSerializer: Default $http params serializer that converts objects to strings according to the some rules $httpParamSerializerJQLike Service to use it for serializing $http request parameters set it as the paramSerializer property:
$http: facilitates communication with the remote HTTP servers (API Call)
$xhrFactory: Factory function used to create XMLHttpRequest objects.
$httpBackend: HTTP backend used by the service that delegates to XMLHttpRequest object or JSONP and deals with browser incompatibilities.
$interpolate: Compiles a string with markup into an interpolation function. This service is used by the HTML $compile service for data binding. See $interpolateProvider for configuring the interpolation markup.
$interval: AngularJS’s wrapper for window.setInterval. The fn function is executed every delay milliseconds.
$jsonpCallbacks: This service handles the lifecycle of callbacks to handle JSONP requests. Override this service if you wish to customize where the callbacks are stored and how they vary compared to the requested URL.
$locale: Service provides localization rules for various AngularJS components.
$location: service parses the URL in the browser address bar and makes the URL available to your application
$log: Simple service for logging
$parse: Converts AngularJS expression into a function.
$q: Service that helps you run functions asynchronously, and use their return values (or exceptions) when they are done processing.
$rootElement: This is either the element where ngApp was declared or the element passed into angular.bootstrap
$rootScope: Scopes provide separation between the model and the view, via a mechanism for watching the model for changes.
$sceDelegate: Service that is used by the $sce service to provide Strict Contextual Escaping (SCE) services to AngularJS.
$sce: Strict Contextual Escaping (SCE) is a mode in which AngularJS constrains bindings to only render trusted values.
$templateRequest: The $templateRequest service runs security checks then downloads the provided template using $http and, upon success, stores the contents inside of $templateCache
$timeout: The return value of calling $timeout is a promise, which will be resolved when the delay has passed and the timeout function if provided, is executed.
$window: Service is globally available in JavaScript