I tried running it like this:
response.then(function (data) {
            deferred.resolve(data);
        });
        response.catch(function (data) {
            alert('Error');
        });
        // Return the promise to the controller
        return deferred.promise;
And controller:
service.execute("webservice", "method", parameters).then(result);

function result(data) {
*   // data.d now is accessed as data.data.d*
}

So, what's a benefit of changing it at all? Or I am still doing it wrong?

On Sat, Sep 12, 2015 at 8:14 AM Sander Elias <[email protected]> wrote:

> Not at all. there is no difference. an $http call just returns a promise.
> it always did that.
>
>
> On Saturday, September 12, 2015 at 2:57:20 PM UTC+2, mark goldin wrote:
>>
>> I am confused by the fact that I use 'then' in my service and in
>> controller.
>>
>> Here is my controller:
>> service.execute("webservice", "method", parameters).then(serviceSuccess);
>> How would I change my controller?
>>
>> On Saturday, September 12, 2015 at 7:41:55 AM UTC-5, Sander Elias wrote:
>>>
>>> Yes, that's what I mean. Did you even try to run it? It probably will
>>> without issue.
>>>
>> --
> You received this message because you are subscribed to a topic in the
> Google Groups "AngularJS" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/angular/pU8sW45XZxo/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/angular.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to