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

Commit cb2db20

Browse files
SQUASH ME: feat($http): specify the JSONP callback via the jsonpCallbackParam config value
1 parent a69729d commit cb2db20

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

docs/content/error/$http/badjsonp.ngdoc

+10-8
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,18 @@
33
@fullName Bad JSONP Request Configuration
44
@description
55

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

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

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

16-
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`.
17+
To resolve this error, remove any parameters that have the same name as the `jsonpCallbackParam`;
18+
and/or remove any parameters that have a value of `JSON_CALLBACK`.
1719

1820
For more information, see the {@link ng.$http#jsonp `$http.jsonp()`} method API documentation.

src/ng/http.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -286,9 +286,9 @@ function $HttpProvider() {
286286
* If specified as string, it is interpreted as a function registered with the {@link auto.$injector $injector}.
287287
* Defaults to {@link ng.$httpParamSerializer $httpParamSerializer}.
288288
*
289-
* - **`defaults.jsonpCallbackParam`** - `{string} - the name of the query parameter that passes the callback in a JSONP
290-
* request. The value of this parameter will be replaced with the expression generated by the {@link $jsonpCallbacks}
291-
* service. Defaults to `'callback'`.
289+
* - **`defaults.jsonpCallbackParam`** - `{string} - the name of the query parameter that passes the name of the
290+
* callback in a JSONP request. The value of this parameter will be replaced with the expression generated by the
291+
* {@link $jsonpCallbacks} service. Defaults to `'callback'`.
292292
*
293293
**/
294294
var defaults = this.defaults = {
@@ -1183,8 +1183,8 @@ function $HttpProvider() {
11831183
* $http.jsonp('some/trusted/url', {jsonpCallbackParam: 'callback'})
11841184
* ```
11851185
*
1186-
* You can also specify a global callback parameter key in `$http.defaults.jsonpCallbackParam`.
1187-
* By default this is set to `'callback'`.
1186+
* You can also specify a default callback parameter name in `$http.defaults.jsonpCallbackParam`.
1187+
* Initially this is set to `'callback'`.
11881188
*
11891189
* <div class="alert alert-danger">
11901190
* You can no longer use the `JSON_CALLBACK` string as a placeholder for specifying where the callback

0 commit comments

Comments
 (0)