Improve this Doc View Source $jsonpCallbacks

  1. service in module ng

This service handles the lifecycle of callbacks to handle JSONP requests. Override this service if you wish to customise where the callbacks are stored and how they vary compared to the requested url.

Dependencies

Methods

  • createCallback(url);

    $httpBackend calls this method to create a callback and get hold of the path to the callback to pass to the server, which will be used to call the callback with its payload in the JSONP response.

    Parameters

    Param Type Details
    url string

    the url of the JSONP request

    Returns

    string

    the callback path to send to the server as part of the JSONP request

  • wasCalled(callbackPath);

    $httpBackend calls this method to find out whether the JSONP response actually called the callback that was passed in the request.

    Parameters

    Param Type Details
    callbackPath string

    the path to the callback that was sent in the JSONP request

    Returns

    boolean

    whether the callback has been called, as a result of the JSONP response

  • getResponse(callbackPath);

    $httpBackend calls this method to get hold of the data that was provided to the callback in the JSONP response.

    Parameters

    Param Type Details
    callbackPath string

    the path to the callback that was sent in the JSONP request

    Returns

    *

    the data received from the response via the registered callback

  • removeCallback(callbackPath);

    $httpBackend calls this method to remove the callback after the JSONP request has completed or timed-out.

    Parameters

    Param Type Details
    callbackPath string

    the path to the callback that was sent in the JSONP request

© 2010–2017 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://code.angularjs.org/1.5.11/docs/api/ng/service/$jsonpCallbacks