diff options
| author | Igor Minar | 2011-11-24 03:53:04 -0800 |
|---|---|---|
| committer | Igor Minar | 2011-11-30 14:49:35 -0500 |
| commit | dbd880cc0a9521bd5b9c96ca3f052450c3def336 (patch) | |
| tree | fc524b84aab7ea1f67ff14962ea31f1e735f628c /src/Resource.js | |
| parent | bf8e0540f8195edbaaa3d0138bd6a26e79e1ab58 (diff) | |
| download | angular.js-dbd880cc0a9521bd5b9c96ca3f052450c3def336.tar.bz2 | |
feat($http): add promise support
quite messy, some tests are missing, contains an experimental jasmine DI support)
Diffstat (limited to 'src/Resource.js')
| -rw-r--r-- | src/Resource.js | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/Resource.js b/src/Resource.js index 4bec60f9..f4440e00 100644 --- a/src/Resource.js +++ b/src/Resource.js @@ -111,7 +111,8 @@ ResourceFactory.prototype = { method: action.method, url: route.url(extend({}, extractParams(data), action.params || {}, params)), data: data - }).on('success', function(response, status) { + }).then(function(response) { + response = response.data; if (response) { if (action.isArray) { value.length = 0; @@ -123,9 +124,7 @@ ResourceFactory.prototype = { } } (success||noop)(value); - }); - - if (error) future.on('error', error); + }, error); return value; }; |
