aboutsummaryrefslogtreecommitdiffstats
path: root/src/service
diff options
context:
space:
mode:
authorVojta Jina2011-08-10 15:59:55 +0200
committerIgor Minar2011-11-30 11:03:41 -0500
commit45f47ff6cd264dcd347e6df92c9ef39b0ae8aaba (patch)
tree3b18d13dca703ee7ce21f11729ff3db31a55cfb9 /src/service
parent0c8b35681e2ea9ce3ee6a188476f89be1336f1cb (diff)
downloadangular.js-45f47ff6cd264dcd347e6df92c9ef39b0ae8aaba.tar.bz2
fix($browser.xhr): change method "JSON" to "JSONP"
Breaks "JSON" xhr method is now called "JSONP"
Diffstat (limited to 'src/service')
-rw-r--r--src/service/browser.js2
-rw-r--r--src/service/resource.js4
-rw-r--r--src/service/xhr.js8
3 files changed, 7 insertions, 7 deletions
diff --git a/src/service/browser.js b/src/service/browser.js
index da82b9b0..65a63f62 100644
--- a/src/service/browser.js
+++ b/src/service/browser.js
@@ -99,7 +99,7 @@ function Browser(window, document, body, XHR, $log, $sniffer) {
*/
self.xhr = function(method, url, post, callback, headers) {
outstandingRequestCount ++;
- if (lowercase(method) == 'json') {
+ if (lowercase(method) == 'jsonp') {
var callbackId = ("angular_" + Math.random() + '_' + (idCounter++)).replace(/\d\./, '');
window[callbackId] = function(data) {
window[callbackId].data = data;
diff --git a/src/service/resource.js b/src/service/resource.js
index 969e4be1..2082b9ed 100644
--- a/src/service/resource.js
+++ b/src/service/resource.js
@@ -40,7 +40,7 @@
* - `action` – {string} – The name of action. This name becomes the name of the method on your
* resource object.
* - `method` – {string} – HTTP request method. Valid methods are: `GET`, `POST`, `PUT`, `DELETE`,
- * and `JSON` (also known as JSONP).
+ * and `JSONP`
* - `params` – {object=} – Optional set of pre-bound parameters for this action.
* - isArray – {boolean=} – If true then the returned object for this action is an array, see
* `returns` section.
@@ -163,7 +163,7 @@
this.Activity = $resource(
'https://www.googleapis.com/buzz/v1/activities/:userId/:visibility/:activityId/:comments',
{alt:'json', callback:'JSON_CALLBACK'},
- {get:{method:'JSON', params:{visibility:'@self'}}, replies: {method:'JSON', params:{visibility:'@self', comments:'@comments'}}}
+ {get:{method:'JSONP', params:{visibility:'@self'}}, replies: {method:'JSONP', params:{visibility:'@self', comments:'@comments'}}}
);
}
diff --git a/src/service/xhr.js b/src/service/xhr.js
index d9c78fd6..7970622b 100644
--- a/src/service/xhr.js
+++ b/src/service/xhr.js
@@ -85,7 +85,7 @@
* {@link http://en.wikipedia.org/wiki/Rainbow_table salt for added security}.
*
* @param {string} method HTTP method to use. Valid values are: `GET`, `POST`, `PUT`, `DELETE`, and
- * `JSON`. `JSON` is a special case which causes a
+ * `JSONP`. `JSONP` is a special case which causes a
* [JSONP](http://en.wikipedia.org/wiki/JSON#JSONP) cross domain request using script tag
* insertion.
* @param {string} url Relative or absolute URL specifying the destination of the request. For
@@ -135,13 +135,13 @@
<div ng:controller="FetchCntl">
<select ng:model="method">
<option>GET</option>
- <option>JSON</option>
+ <option>JSONP</option>
</select>
<input type="text" ng:model="url" size="80"/>
<button ng:click="fetch()">fetch</button><br>
<button ng:click="updateModel('GET', 'index.html')">Sample GET</button>
- <button ng:click="updateModel('JSON', 'http://angularjs.org/greet.php?callback=JSON_CALLBACK&name=Super%20Hero')">Sample JSONP</button>
- <button ng:click="updateModel('JSON', 'http://angularjs.org/doesntexist&callback=JSON_CALLBACK')">Invalid JSONP</button>
+ <button ng:click="updateModel('JSONP', 'http://angularjs.org/greet.php?callback=JSON_CALLBACK&name=Super%20Hero')">Sample JSONP</button>
+ <button ng:click="updateModel('JSONP', 'http://angularjs.org/doesntexist&callback=JSON_CALLBACK')">Invalid JSONP</button>
<pre>code={{code}}</pre>
<pre>response={{response}}</pre>
</div>