30

One of the things about Angular that's both a feature and a point of complexity, is that it's not very opinionated about how to interact with a RESTful API. I know about $resource, Restangular, and various ideas you can find on rolling your own.

In a complex application that's got a large number of resources, including various nestings, there's reason to think that Restangular's superior to $resource; for similar reasons, also that Restangular's better than rolling your own.

One solution that I haven't seen until recently is JSData and its wrapper for AngularJS (repo). Judging from the number of favorites on Github (~900), it has a decent number of people at least interested in it, if not using it. It's only a fraction of the following that Restangular has on Github (5k+), but still significant.

For those who have used both Restangular and JSData, what's your take on how they compare (strengths/weaknesses; differences in purpose, reliability, etc.; things that may not be readily apparent from the docs)? For this question to remain open, please stick to facts rather than opinions.

My impressions from what I've read are the following:

Restangular

  • (+) Big mindshare
  • (+) Highly customizable
  • (-) Focus seems to be on the actual interaction with the RESTful API only, rather than also being opinionated/acting as a data store once it's returned (please correct me if I'm wrong). Granted, this could be considered a feature, in the same way Angular's lack of opinion is a feature. I'm putting this is as a disadvantage for now, though, because of the additional legwork this means for the developer to come up with their own solution.

JSData

  • (+) Works not only with REST, but localStorage, localforage, Firebase, etc, including custom adapters
  • (+) Designed as a cached data store to not have to repeat HTTP calls (to be fair, caching is also an option with Restangular, though perhaps less intertwined/critical to its mission)
  • (-) Not as large a following, although the developer does seem committed
14
  • 7
    I find it a little weird you're penalizing RESTangular for only working with RESTful APIs. It's literally in the name.
    – Jhecht
    Feb 5, 2015 at 0:56
  • I updated that point in my question to clarify. I'm not penalizing it for focusing on REST; that's fine and good. I'm just saying it doesn't seem to also have a focus on being a data store itself once that data's obtained from the API; I think that's a fair critique of Restangular, though one could argue it's a feature like I mentioned, since it leaves things wide open for the developer to do what they like.
    – jmq
    Feb 5, 2015 at 1:08
  • 1
    I may end up trying both out as you suggest. Given that js-data-angular has just under a thousand favs on Github, though, and Restangular has several thousand, I thought there might be some knowledge out there to share. Thanks
    – jmq
    Feb 5, 2015 at 1:25
  • 3
    I respectfully disagree w/the conclusions at that meta link and how it applies here: 1. I'm not looking for a recommendation. In my time since asking the question, I'm gathering experience on how both have strengths/weaknesses in different contexts, not that one's just better. That insight's what I would've liked at the outset. 2. Honestly not sure what'd be wrong with a useful comparative list on SO. There's lists of other sorts that end up answering questions here and are useful. Given the upvotes and favorites on this question, there's others who'd benefit from this as well.
    – jmq
    Apr 9, 2015 at 13:27
  • 3
    I find it frustrating that questions like this are always closed. It seems that the community likes them, but mods are eager to close anything that comes across as being remotely opinion-based. If the community wants it, and if the discussion is fact-based, what harm is there in keeping the question open?
    – rinogo
    Jun 4, 2016 at 0:46

0