Improve this Doc View Source $xhrFactory

From Get docs
< Service components in ngAngularjs/docs/1.8/api/ng/service/$xhrfactory

Improve this Doc View Source $xhrFactory

  1. service in module ng


Factory function used to create XMLHttpRequest objects.

Replace or decorate this service to create your own custom XMLHttpRequest objects.

angular.module('myApp', [])
.factory('$xhrFactory', function() {
  return function createXhr(method, url) {
    return new window.XMLHttpRequest({mozSystem: true});


$xhrFactory(method, url);


Param Type Details
method string HTTP method of the request (GET, POST, PUT, ..)
url string URL of the request.

© 2010–2020 Google, Inc.
Licensed under the Creative Commons Attribution License 3.0.$xhrFactory