javascript - What is the advantage of using Restangular over ngResource? -
ngresource
seems simple implement things with...
what advantages / disadvantages of using restangular on ngresource?
1.1.3 $resource
return promises , can implimented using latest pr commit. future support offered $resource
support additional verbs restangular does? , if happens restangular seems disappear , become irrelivant.
i'm creator of restangular.
i've created section on readme differences against $resource. can check them out here https://github.com/mgonto/restangular/blob/master/readme.md#differences-with-resource
anyway, sum up, besides additional features , promise based approach, idea restangular can handle of urls, don't have know them.
suppose have cars : /users/123/cars/456
in $resource, you'd have construct url manually , you'd have construct $resource object manually. restangular helps in "remembering" urls.
so if in place
restangular.one("users", 123).get().then(function(user) { $scope.user = user; }); // other code //automatically request /users/123/cars remembers in object you're asking it. $scope.user.getlist('cars')
hope helps!
Comments
Post a Comment