diff options
| author | Misko Hevery | 2011-11-09 22:23:36 -0800 | 
|---|---|---|
| committer | Misko Hevery | 2011-11-14 20:31:16 -0800 | 
| commit | 57c37a21d1d876dd638bca1de21d59a9e639843e (patch) | |
| tree | b2c8a71591683baa9b36af0559d993af94f2a3d9 | |
| parent | 74fac45f48acd5b2fc57befd7dd7739805e330c3 (diff) | |
| download | angular.js-57c37a21d1d876dd638bca1de21d59a9e639843e.tar.bz2 | |
doc(service): update docs for the moved services
| -rw-r--r-- | src/service/compiler.js | 28 | ||||
| -rw-r--r-- | src/service/cookieStore.js | 16 | ||||
| -rw-r--r-- | src/service/cookies.js | 4 | ||||
| -rw-r--r-- | src/service/defer.js | 12 | ||||
| -rw-r--r-- | src/service/document.js | 4 | ||||
| -rw-r--r-- | src/service/exceptionHandler.js | 6 | ||||
| -rw-r--r-- | src/service/location.js | 40 | ||||
| -rw-r--r-- | src/service/log.js | 20 | ||||
| -rw-r--r-- | src/service/resource.js | 8 | ||||
| -rw-r--r-- | src/service/route.js | 44 | ||||
| -rw-r--r-- | src/service/routeParams.js | 8 | ||||
| -rw-r--r-- | src/service/sniffer.js | 4 | ||||
| -rw-r--r-- | src/service/window.js | 4 | ||||
| -rw-r--r-- | src/service/xhr.bulk.js | 4 | ||||
| -rw-r--r-- | src/service/xhr.cache.js | 8 | ||||
| -rw-r--r-- | src/service/xhr.error.js | 8 | ||||
| -rw-r--r-- | src/service/xhr.js | 12 | 
17 files changed, 116 insertions, 114 deletions
| diff --git a/src/service/compiler.js b/src/service/compiler.js index 1bd2cbe0..1e07d47c 100644 --- a/src/service/compiler.js +++ b/src/service/compiler.js @@ -79,7 +79,7 @@ function $CompileProvider(){        /**         * @ngdoc function -       * @name angular.compile +       * @name angular.module.NG.$compile         * @function         *         * @description @@ -97,16 +97,19 @@ function $CompileProvider(){         * that is a DOM clone of the original template.         *           <pre> -          // compile the entire window.document and give me the scope bound to this template. -          var rootScope = angular.compile(window.document)(); +          angular.injector('ng').invoke(null, function($rootScope, $compile) { +            // Chose one: -          // compile a piece of html -          var rootScope2 = angular.compile('<div ng:click="clicked = true">click me</div>')(); +            // A: compile the entire window.document. +            var element = $compile(window.document)($rootScope); -          // compile a piece of html and retain reference to both the dom and scope -          var template = angular.element('<div ng:click="clicked = true">click me</div>'), -              scope = angular.compile(template)(); -          // at this point template was transformed into a view +            // B: compile a piece of html +            var element = $compile('<div ng:click="clicked = true">click me</div>')($rootScope); + +            // C: compile a piece of html and retain reference to both the dom and scope +            var element = $compile('<div ng:click="clicked = true">click me</div>')(scope); +            // at this point template was transformed into a view +          });           </pre>         *         * @@ -140,8 +143,9 @@ function $CompileProvider(){         * - If you are not asking the linking function to clone the template, create the DOM element(s)         *   before you send them to the compiler and keep this reference around.         *   <pre> -       *     var scope = angular.injector()('$rootScope'); -       *     var element = angular.compile('<p>{{total}}</p>')(scope); +       *     var scope = angular.injector('NG')(function($rootScope, $compile){ +       *       var element = $compile('<p>{{total}}</p>')($rootScope); +       *     });         *   </pre>         *         * - if on the other hand, you need the element to be cloned, the view reference from the original @@ -152,7 +156,7 @@ function $CompileProvider(){         *         scope = someParentScope.$new(),         *         clone;         * -       *     angular.compile(original)(scope, function(clonedElement, scope) { +       *     $compile(original)(scope, function(clonedElement, scope) {         *       clone = clonedElement;         *       //attach the clone to DOM document at the right place         *     }); diff --git a/src/service/cookieStore.js b/src/service/cookieStore.js index 0aa13ed2..2bd00585 100644 --- a/src/service/cookieStore.js +++ b/src/service/cookieStore.js @@ -1,8 +1,8 @@  'use strict';  /** - * @ngdoc service - * @name angular.service.$cookieStore + * @ngdoc object + * @name angular.module.NG.$cookieStore   * @requires $cookies   *   * @description @@ -17,8 +17,8 @@ function $CookieStoreProvider(){      return {        /**         * @ngdoc method -       * @name angular.service.$cookieStore#get -       * @methodOf angular.service.$cookieStore +       * @name angular.module.NG.$cookieStore#get +       * @methodOf angular.module.NG.$cookieStore         *         * @description         * Returns the value of given cookie key @@ -32,8 +32,8 @@ function $CookieStoreProvider(){        /**         * @ngdoc method -       * @name angular.service.$cookieStore#put -       * @methodOf angular.service.$cookieStore +       * @name angular.module.NG.$cookieStore#put +       * @methodOf angular.module.NG.$cookieStore         *         * @description         * Sets a value for given cookie key @@ -47,8 +47,8 @@ function $CookieStoreProvider(){        /**         * @ngdoc method -       * @name angular.service.$cookieStore#remove -       * @methodOf angular.service.$cookieStore +       * @name angular.module.NG.$cookieStore#remove +       * @methodOf angular.module.NG.$cookieStore         *         * @description         * Remove given cookie diff --git a/src/service/cookies.js b/src/service/cookies.js index 16e14847..ca996b6e 100644 --- a/src/service/cookies.js +++ b/src/service/cookies.js @@ -1,8 +1,8 @@  'use strict';  /** - * @ngdoc service - * @name angular.service.$cookies + * @ngdoc object + * @name angular.module.NG.$cookies   * @requires $browser   *   * @description diff --git a/src/service/defer.js b/src/service/defer.js index 90e6f19f..58dc5b09 100644 --- a/src/service/defer.js +++ b/src/service/defer.js @@ -1,14 +1,14 @@  'use strict';  /** - * @ngdoc service - * @name angular.service.$defer + * @ngdoc function + * @name angular.module.NG.$defer   * @requires $browser   *   * @description - * Delegates to {@link angular.service.$browser $browser.defer}, but wraps the `fn` function + * Delegates to {@link angular.module.NG.$browser#defer $browser.defer}, but wraps the `fn` function   * into a try/catch block and delegates any exceptions to - * {@link angular.service.$exceptionHandler $exceptionHandler} service. + * {@link angular.module.NG.$exceptionHandler $exceptionHandler} service.   *   * In tests you can use `$browser.defer.flush()` to flush the queue of deferred functions.   * @@ -19,8 +19,8 @@  /**   * @ngdoc function - * @name angular.service.$defer#cancel - * @methodOf angular.service.$defer + * @name angular.module.NG.$defer#cancel + * @methodOf angular.module.NG.$defer   *   * @description   * Cancels a defered task identified with `deferId`. diff --git a/src/service/document.js b/src/service/document.js index f71ac33a..4db1fe12 100644 --- a/src/service/document.js +++ b/src/service/document.js @@ -1,8 +1,8 @@  'use strict';  /** - * @ngdoc service - * @name angular.service.$document + * @ngdoc object + * @name angular.module.NG.$document   * @requires $window   *   * @description diff --git a/src/service/exceptionHandler.js b/src/service/exceptionHandler.js index c53118b4..f771e294 100644 --- a/src/service/exceptionHandler.js +++ b/src/service/exceptionHandler.js @@ -1,8 +1,8 @@  'use strict';  /** - * @ngdoc service - * @name angular.service.$exceptionHandler + * @ngdoc function + * @name angular.module.NG.$exceptionHandler   * @requires $log   *   * @description @@ -12,8 +12,6 @@   *   * In unit tests, if `angular-mocks.js` is loaded, this service is overriden by   * {@link angular.module.NG_MOCK.$exceptionHandler mock $exceptionHandler} - * - * @example   */  function $ExceptionHandlerProvider(){    this.$get = ['$log', function($log){ diff --git a/src/service/location.js b/src/service/location.js index 11a69e96..d7286291 100644 --- a/src/service/location.js +++ b/src/service/location.js @@ -205,8 +205,8 @@ LocationUrl.prototype = LocationHashbangUrl.prototype = {    /**     * @ngdoc method -   * @name angular.service.$location#absUrl -   * @methodOf angular.service.$location +   * @name angular.module.NG.$location#absUrl +   * @methodOf angular.module.NG.$location     *     * @description     * This method is getter only. @@ -220,8 +220,8 @@ LocationUrl.prototype = LocationHashbangUrl.prototype = {    /**     * @ngdoc method -   * @name angular.service.$location#url -   * @methodOf angular.service.$location +   * @name angular.module.NG.$location#url +   * @methodOf angular.module.NG.$location     *     * @description     * This method is getter / setter. @@ -246,8 +246,8 @@ LocationUrl.prototype = LocationHashbangUrl.prototype = {    /**     * @ngdoc method -   * @name angular.service.$location#protocol -   * @methodOf angular.service.$location +   * @name angular.module.NG.$location#protocol +   * @methodOf angular.module.NG.$location     *     * @description     * This method is getter only. @@ -260,8 +260,8 @@ LocationUrl.prototype = LocationHashbangUrl.prototype = {    /**     * @ngdoc method -   * @name angular.service.$location#host -   * @methodOf angular.service.$location +   * @name angular.module.NG.$location#host +   * @methodOf angular.module.NG.$location     *     * @description     * This method is getter only. @@ -274,8 +274,8 @@ LocationUrl.prototype = LocationHashbangUrl.prototype = {    /**     * @ngdoc method -   * @name angular.service.$location#port -   * @methodOf angular.service.$location +   * @name angular.module.NG.$location#port +   * @methodOf angular.module.NG.$location     *     * @description     * This method is getter only. @@ -288,8 +288,8 @@ LocationUrl.prototype = LocationHashbangUrl.prototype = {    /**     * @ngdoc method -   * @name angular.service.$location#path -   * @methodOf angular.service.$location +   * @name angular.module.NG.$location#path +   * @methodOf angular.module.NG.$location     *     * @description     * This method is getter / setter. @@ -310,8 +310,8 @@ LocationUrl.prototype = LocationHashbangUrl.prototype = {    /**     * @ngdoc method -   * @name angular.service.$location#search -   * @methodOf angular.service.$location +   * @name angular.module.NG.$location#search +   * @methodOf angular.module.NG.$location     *     * @description     * This method is getter / setter. @@ -343,8 +343,8 @@ LocationUrl.prototype = LocationHashbangUrl.prototype = {    /**     * @ngdoc method -   * @name angular.service.$location#hash -   * @methodOf angular.service.$location +   * @name angular.module.NG.$location#hash +   * @methodOf angular.module.NG.$location     *     * @description     * This method is getter / setter. @@ -360,8 +360,8 @@ LocationUrl.prototype = LocationHashbangUrl.prototype = {    /**     * @ngdoc method -   * @name angular.service.$location#replace -   * @methodOf angular.service.$location +   * @name angular.module.NG.$location#replace +   * @methodOf angular.module.NG.$location     *     * @description     * If called, all changes to $location during current `$digest` will be replacing current history @@ -395,8 +395,8 @@ function locationGetterSetter(property, preprocess) {  /** - * @ngdoc service - * @name angular.service.$location + * @ngdoc object + * @name angular.module.NG.$location   *   * @requires $browser   * @requires $sniffer diff --git a/src/service/log.js b/src/service/log.js index 59094c42..14ae2a57 100644 --- a/src/service/log.js +++ b/src/service/log.js @@ -1,8 +1,8 @@  'use strict';  /** - * @ngdoc service - * @name angular.service.$log + * @ngdoc object + * @name angular.module.NG.$log   * @requires $window   *   * @description @@ -40,8 +40,8 @@ function $LogProvider(){      return {        /**         * @ngdoc method -       * @name angular.service.$log#log -       * @methodOf angular.service.$log +       * @name angular.module.NG.$log#log +       * @methodOf angular.module.NG.$log         *         * @description         * Write a log message @@ -50,8 +50,8 @@ function $LogProvider(){        /**         * @ngdoc method -       * @name angular.service.$log#warn -       * @methodOf angular.service.$log +       * @name angular.module.NG.$log#warn +       * @methodOf angular.module.NG.$log         *         * @description         * Write a warning message @@ -60,8 +60,8 @@ function $LogProvider(){        /**         * @ngdoc method -       * @name angular.service.$log#info -       * @methodOf angular.service.$log +       * @name angular.module.NG.$log#info +       * @methodOf angular.module.NG.$log         *         * @description         * Write an information message @@ -70,8 +70,8 @@ function $LogProvider(){        /**         * @ngdoc method -       * @name angular.service.$log#error -       * @methodOf angular.service.$log +       * @name angular.module.NG.$log#error +       * @methodOf angular.module.NG.$log         *         * @description         * Write an error message diff --git a/src/service/resource.js b/src/service/resource.js index e396e521..bdd0058d 100644 --- a/src/service/resource.js +++ b/src/service/resource.js @@ -1,8 +1,8 @@  'use strict';  /** - * @ngdoc service - * @name angular.service.$resource + * @ngdoc object + * @name angular.module.NG.$resource   * @requires $xhr.cache   *   * @description @@ -10,7 +10,7 @@   * [RESTful](http://en.wikipedia.org/wiki/Representational_State_Transfer) server-side data sources.   *   * The returned resource object has action methods which provide high-level behaviors without - * the need to interact with the low level {@link angular.service.$xhr $xhr} service or + * the need to interact with the low level {@link angular.module.NG.$xhr $xhr} service or   * raw XMLHttpRequest.   *   * @param {string} url A parameterized URL template with parameters prefixed by `:` as in @@ -57,7 +57,7 @@   *         'remove': {method:'DELETE'},   *         'delete': {method:'DELETE'} };   * - *   Calling these methods invoke an {@link angular.service.$xhr} with the specified http method, + *   Calling these methods invoke an {@link angular.module.NG.$xhr} with the specified http method,   *   destination and parameters. When the data is returned from the server then the object is an   *   instance of the resource class `save`, `remove` and `delete` actions are available on it as   *   methods with the `$` prefix. This allows you to easily perform CRUD operations (create, read, diff --git a/src/service/route.js b/src/service/route.js index f2ecbd2a..61f43c29 100644 --- a/src/service/route.js +++ b/src/service/route.js @@ -1,8 +1,8 @@  'use strict';  /** - * @ngdoc service - * @name angular.service.$route + * @ngdoc object + * @name angular.module.NG.$route   * @requires $location   * @requires $routeParams   * @@ -14,7 +14,7 @@   * definition. It is used for deep-linking URLs to controllers and views (HTML partials).   *   * The `$route` service is typically used in conjunction with {@link angular.widget.ng:view ng:view} - * widget and the {@link angular.service.$routeParams $routeParams} service. + * widget and the {@link angular.module.NG.$routeParams $routeParams} service.   *   * @example     This example shows how changing the URL hash causes the <tt>$route</tt> @@ -67,8 +67,8 @@ function $RouteProvider(){        function( $rootScope,  $location,  $routeParams) {      /**       * @ngdoc event -     * @name angular.service.$route#$beforeRouteChange -     * @eventOf angular.service.$route +     * @name angular.module.NG.$route#$beforeRouteChange +     * @eventOf angular.module.NG.$route       * @eventType broadcast on root scope       * @description       * Broadcasted before a route change. @@ -79,14 +79,14 @@ function $RouteProvider(){       * The `Route` object extends the route definition with the following properties.       *       *    * `scope` - The instance of the route controller. -     *    * `params` - The current {@link angular.service.$routeParams params}. +     *    * `params` - The current {@link angular.module.NG.$routeParams params}.       *       */      /**       * @ngdoc event -     * @name angular.service.$route#$afterRouteChange -     * @eventOf angular.service.$route +     * @name angular.module.NG.$route#$afterRouteChange +     * @eventOf angular.module.NG.$route       * @eventType broadcast on root scope       * @description       * Broadcasted after a route change. @@ -97,14 +97,14 @@ function $RouteProvider(){       * The `Route` object extends the route definition with the following properties.       *       *    * `scope` - The instance of the route controller. -     *    * `params` - The current {@link angular.service.$routeParams params}. +     *    * `params` - The current {@link angular.module.NG.$routeParams params}.       *       */      /**       * @ngdoc event -     * @name angular.service.$route#$routeUpdate -     * @eventOf angular.service.$route +     * @name angular.module.NG.$route#$routeUpdate +     * @eventOf angular.module.NG.$route       * @eventType emit on the current route scope       * @description       * @@ -122,8 +122,8 @@ function $RouteProvider(){            /**             * @ngdoc method -           * @name angular.service.$route#parent -           * @methodOf angular.service.$route +           * @name angular.module.NG.$route#parent +           * @methodOf angular.module.NG.$route             *             * @param {Scope} [scope=rootScope] Scope to be used as parent for newly created             *    `$route.current.scope` scopes. @@ -138,8 +138,8 @@ function $RouteProvider(){            /**             * @ngdoc method -           * @name angular.service.$route#when -           * @methodOf angular.service.$route +           * @name angular.module.NG.$route#when +           * @methodOf angular.module.NG.$route             *             * @param {string} path Route path (matched against `$location.hash`)             * @param {Object} route Mapping information to be assigned to `$route.current` on route @@ -153,7 +153,7 @@ function $RouteProvider(){             *      {@link angular.widget.ng:view ng:view} or             *      {@link angular.widget.ng:include ng:include} widgets.             *    - `redirectTo` – {(string|function())=} – value to update -           *      {@link angular.service.$location $location} path with and trigger route redirection. +           *      {@link angular.module.NG.$location $location} path with and trigger route redirection.             *             *      If `redirectTo` is a function, it will be called with the following parameters:             * @@ -170,7 +170,7 @@ function $RouteProvider(){             *             *      If the option is set to false and url in the browser changes, then             *      $routeUpdate event is emited on the current route scope. You can use this event to -           *      react to {@link angular.service.$routeParams} changes: +           *      react to {@link angular.module.NG.$routeParams} changes:             *             *            function MyCtrl($route, $routeParams) {             *              this.$on('$routeUpdate', function() { @@ -193,8 +193,8 @@ function $RouteProvider(){            /**             * @ngdoc method -           * @name angular.service.$route#otherwise -           * @methodOf angular.service.$route +           * @name angular.module.NG.$route#otherwise +           * @methodOf angular.module.NG.$route             *             * @description             * Sets route definition that will be used on route change when no other route definition @@ -208,12 +208,12 @@ function $RouteProvider(){            /**             * @ngdoc method -           * @name angular.service.$route#reload -           * @methodOf angular.service.$route +           * @name angular.module.NG.$route#reload +           * @methodOf angular.module.NG.$route             *             * @description             * Causes `$route` service to reload (and recreate the `$route.current` scope) upon the next -           * eval even if {@link angular.service.$location $location} hasn't changed. +           * eval even if {@link angular.module.NG.$location $location} hasn't changed.             */            reload: function() {              dirty++; diff --git a/src/service/routeParams.js b/src/service/routeParams.js index df89c739..bb59bb28 100644 --- a/src/service/routeParams.js +++ b/src/service/routeParams.js @@ -1,14 +1,14 @@  'use strict';  /** - * @ngdoc service - * @name angular.service.$routeParams + * @ngdoc object + * @name angular.module.NG.$routeParams   * @requires $route   *   * @description   * Current set of route parameters. The route parameters are a combination of the - * {@link angular.service.$location $location} `search()`, and `path()`. The `path` parameters - * are extracted when the {@link angular.service.$route $route} path is matched. + * {@link angular.module.NG.$location $location} `search()`, and `path()`. The `path` parameters + * are extracted when the {@link angular.module.NG.$route $route} path is matched.   *   * In case of parameter name collision, `path` params take precedence over `search` params.   * diff --git a/src/service/sniffer.js b/src/service/sniffer.js index 8f6efeef..a8b6b1a5 100644 --- a/src/service/sniffer.js +++ b/src/service/sniffer.js @@ -1,8 +1,8 @@  'use strict';  /** - * @ngdoc service - * @name angular.service.$sniffer + * @ngdoc object + * @name angular.module.NG.$sniffer   * @requires $window   *   * @property {boolean} history Does the browser support html5 history api ? diff --git a/src/service/window.js b/src/service/window.js index d5c62146..1a74ab46 100644 --- a/src/service/window.js +++ b/src/service/window.js @@ -1,8 +1,8 @@  'use strict';  /** - * @ngdoc service - * @name angular.service.$window + * @ngdoc object + * @name angular.module.NG.$window   *   * @description   * A reference to the browser's `window` object. While `window` diff --git a/src/service/xhr.bulk.js b/src/service/xhr.bulk.js index b75f4046..727d29c1 100644 --- a/src/service/xhr.bulk.js +++ b/src/service/xhr.bulk.js @@ -1,8 +1,8 @@  'use strict';  /** - * @ngdoc service - * @name angular.service.$xhr.bulk + * @ngdoc object + * @name angular.module.NG.$xhr.bulk   * @requires $xhr   * @requires $xhr.error   * @requires $log diff --git a/src/service/xhr.cache.js b/src/service/xhr.cache.js index a448bfe0..840aaa6c 100644 --- a/src/service/xhr.cache.js +++ b/src/service/xhr.cache.js @@ -1,8 +1,8 @@  'use strict';  /** - * @ngdoc service - * @name angular.service.$xhr.cache + * @ngdoc object + * @name angular.module.NG.$xhr.cache   * @function   *   * @requires $xhr.bulk @@ -11,11 +11,11 @@   * @requires $log   *   * @description - * Acts just like the {@link angular.service.$xhr $xhr} service but caches responses for `GET` + * Acts just like the {@link angular.module.NG.$xhr $xhr} service but caches responses for `GET`   * requests. All cache misses are delegated to the $xhr service.   *   * @property {function()} delegate Function to delegate all the cache misses to. Defaults to - *   the {@link angular.service.$xhr $xhr} service. + *   the {@link angular.module.NG.$xhr $xhr} service.   * @property {object} data The hashmap where all cached entries are stored.   *   * @param {string} method HTTP method. diff --git a/src/service/xhr.error.js b/src/service/xhr.error.js index 6bd2ac78..6f0839b2 100644 --- a/src/service/xhr.error.js +++ b/src/service/xhr.error.js @@ -1,15 +1,15 @@  'use strict';  /** - * @ngdoc service - * @name angular.service.$xhr.error + * @ngdoc object + * @name angular.module.NG.$xhr.error   * @function   * @requires $log   *   * @description - * Error handler for {@link angular.service.$xhr $xhr service}. An application can replaces this + * Error handler for {@link angular.module.NG.$xhr $xhr service}. An application can replaces this   * service with one specific for the application. The default implementation logs the error to - * {@link angular.service.$log $log.error}. + * {@link angular.module.NG.$log $log.error}.   *   * @param {Object} request Request object.   * diff --git a/src/service/xhr.js b/src/service/xhr.js index bd1217b9..d34a37f2 100644 --- a/src/service/xhr.js +++ b/src/service/xhr.js @@ -1,8 +1,8 @@  'use strict';  /** - * @ngdoc service - * @name angular.service.$xhr + * @ngdoc object + * @name angular.module.NG.$xhr   * @function   * @requires $browser $xhr delegates all XHR requests to the `$browser.xhr()`. A mock version   *                    of the $browser exists which allows setting expectations on XHR requests @@ -12,14 +12,14 @@   *   * @description   * Generates an XHR request. The $xhr service delegates all requests to - * {@link angular.service.$browser $browser.xhr()} and adds error handling and security features. + * {@link angular.module.NG.$browser $browser.xhr()} and adds error handling and security features.   * While $xhr service provides nicer api than raw XmlHttpRequest, it is still considered a lower   * level api in angular. For a higher level abstraction that utilizes `$xhr`, please check out the - * {@link angular.service.$resource $resource} service. + * {@link angular.module.NG.$resource $resource} service.   *   * # Error handling   * If no `error callback` is specified, XHR response with response code other then `2xx` will be - * delegated to {@link angular.service.$xhr.error $xhr.error}. The `$xhr.error` can intercept the + * delegated to {@link angular.module.NG.$xhr.error $xhr.error}. The `$xhr.error` can intercept the   * request and process it in application specific way, or resume normal execution by calling the   * request `success` method.   * @@ -98,7 +98,7 @@   *   *   - {number} code [HTTP status code](http://en.wikipedia.org/wiki/List_of_HTTP_status_codes) of   *     the response. This will currently always be 200, since all non-200 responses are routed to - *     {@link angular.service.$xhr.error} service (or custom error callback). + *     {@link angular.module.NG.$xhr.error} service (or custom error callback).   *   - {string|Object} response Response object as string or an Object if the response was in JSON   *     format.   * @param {function(number, (string|Object))} error A function to be called if the response code is | 
