Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
SQUASH ME: feat($http): specify the JSONP callback via the `jsonpCall…
Browse files Browse the repository at this point in the history
…backParam` config value
  • Loading branch information
petebacondarwin committed Oct 4, 2016
1 parent a69729d commit cb2db20
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
18 changes: 10 additions & 8 deletions docs/content/error/$http/badjsonp.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@
@fullName Bad JSONP Request Configuration
@description

This error occurs when the URL generated from the configuration object contains a parameter with the same name as the configured `jsonpCallbackParam`
property; or when it contains a parameter whose value is `JSON_CALLBACK`.
This error occurs when the URL generated from the configuration object contains a parameter with the
same name as the configured `jsonpCallbackParam` property; or when it contains a parameter whose
value is `JSON_CALLBACK`.

`$http` JSONP requests need to attach a callback query parameter to the URL. The name of this parameter is specified in the configuration
object (or in the defaults) via the `jsonpCallbackParam` property. You must not provide your own parameter with this name in the configuration
of the request.
`$http` JSONP requests need to attach a callback query parameter to the URL. The name of this
parameter is specified in the configuration object (or in the defaults) via the `jsonpCallbackParam`
property. You must not provide your own parameter with this name in the configuratio of the request.

In previous versions of Angular, you specified where to add the callback parameter value via the `JSON_CALLBACK` placeholder. This is no longer
allowed.
In previous versions of Angular, you specified where to add the callback parameter value via the
`JSON_CALLBACK` placeholder. This is no longer allowed.

To resolve this error, remove any parameters that have the same name as the `jsonpCallbackParam`; and/or remove any parameters that have a value of `JSON_CALLBACK`.
To resolve this error, remove any parameters that have the same name as the `jsonpCallbackParam`;
and/or remove any parameters that have a value of `JSON_CALLBACK`.

For more information, see the {@link ng.$http#jsonp `$http.jsonp()`} method API documentation.
10 changes: 5 additions & 5 deletions src/ng/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,9 @@ function $HttpProvider() {
* If specified as string, it is interpreted as a function registered with the {@link auto.$injector $injector}.
* Defaults to {@link ng.$httpParamSerializer $httpParamSerializer}.
*
* - **`defaults.jsonpCallbackParam`** - `{string} - the name of the query parameter that passes the callback in a JSONP
* request. The value of this parameter will be replaced with the expression generated by the {@link $jsonpCallbacks}
* service. Defaults to `'callback'`.
* - **`defaults.jsonpCallbackParam`** - `{string} - the name of the query parameter that passes the name of the
* callback in a JSONP request. The value of this parameter will be replaced with the expression generated by the
* {@link $jsonpCallbacks} service. Defaults to `'callback'`.
*
**/
var defaults = this.defaults = {
Expand Down Expand Up @@ -1183,8 +1183,8 @@ function $HttpProvider() {
* $http.jsonp('some/trusted/url', {jsonpCallbackParam: 'callback'})
* ```
*
* You can also specify a global callback parameter key in `$http.defaults.jsonpCallbackParam`.
* By default this is set to `'callback'`.
* You can also specify a default callback parameter name in `$http.defaults.jsonpCallbackParam`.
* Initially this is set to `'callback'`.
*
* <div class="alert alert-danger">
* You can no longer use the `JSON_CALLBACK` string as a placeholder for specifying where the callback
Expand Down

0 comments on commit cb2db20

Please sign in to comment.