Also, one thing I like about $resource is that you work on the object you
have retrieved
If you want to retrieve, update and then save something with $http, you
have to do :
$http.get('http://0.0.0.0/' + 3).success(function(movie) {
movie.name = "My name updated"
$http.put('http://0.0.0.0/', movie);
});
You can see that you have to give the movie objet to $http to update your
resource
With $resource, you have to do :
MovieService.get({id: 3}, function(movie) {
movie.name = "My name edited";
movie.$update();
});
This important thing here is that you call the $update() on the movie
element, which I like :)
On Tuesday, October 14, 2014 12:15:14 AM UTC+2, strgraphics wrote:
>
> Mark,
>
> Thanks for your reply, this is how i was confused every time :-)
> With $http we can call REST as well, then whats the purpose/specialty of
> $resource.
>
> -Jassu
>
> On Monday, October 13, 2014 2:13:14 PM UTC-7, Mark Volkmann wrote:
>>
>> $http lets you send all kinds of HTTP requests and process their
>> responses.
>> $resource tries to make it easier to work with REST services.
>>
>> I think many people, including me, find $http to be very easy to use with
>> REST services and just use that instead of $resource.
>>
>> On Mon, Oct 13, 2014 at 4:08 PM, strgraphics <[email protected]> wrote:
>>
>>> Hi,
>>>
>>> I have searched lot of blogs and documentation, but i ddint get the
>>> satisfied answer for this question. Can someone give 2-3 differences, why
>>> $resource ? and what is the difference.
>>>
>>> --
>>> 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.
>>>
>>
>>
>>
>> --
>> R. Mark Volkmann
>> Object Computing, Inc.
>>
>
--
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.