Angularjs Examples

AJS Examples


AngularJS Built In Services

Angular services are injectable object injected using dependency injection (DI) mechanism of AngularJS. The AngularJS services can be used to organize and share code across your app.

AngularJS Services are

  • Lazily Instantiated - Angular only instantiates a service when an application component depends on it.
  • Singletons - Each component dependent on a service gets a reference to the single instance generated by the service factory.

AngularJS Built in Services

Here is a list of AngularJS built in Services with description.

ServicesDescription
$cookies This service is useful to write, read and delete browser cookies.
$window This service is similar to reference to the browser's window object.
$filter This service is used for formatting data displayed to the user.
$document This service is wrapper for the browser's window.document object.
$location This service is similar to window.location object and exposes the current URL in the browser address bar.
$log This service is useful to write error, info, warning and debugging into the browser's console.
$parse This service is useful to convert AngularJS expression into a function.
$timeout This service is just wrapper for window.setTimeout function so that it will be easy to override, remove or mocked for testing.
$interval This service is similar to JavaScript's window.setInterval function.
$exceptionHandler This service is useful to handle an uncaught exception in angular expressions by overriding the default exception handler behaviour.
$templateCache This service is useful to set form within a form.
$cacheFactory This service evaluates specified expression when the user changes the input.
$anchorScroll This service is useful to set checkbox checked.
$rootScope This service is useful to access the application's main and top level scope.
$rootElement This service is useful to access root element.

Note: Click on above listed built-in AngulatJS servives to know more detail about each service.