5 ms·
My first thought when I saw this was to wonder how it might stack up to RESTangular, which I've toyed around with, but never really committed to because it didn
by bmelton 12y ago
My first thought when I saw this was to wonder how it might stack up to RESTangular, which I've toyed around with, but never really committed to because it didn't offer a ton of value over the in-built services and, really, just manipulating $http directly.
This, however, looks really solid, and excels in its very natural syntax. The way in which an object is called, manipulated and saved back is exactly how I expect an 'ORM' to work... at least until I get down to the "belongsTo" stuff, which is very Railsy -- that's fine, and the intro professes its attempt to mimic ActiveRecord, so it's even expected, just a little rough for me, as I left Rails for Django mostly because I preferred Django's ORM to Rails' ActiveRecord.
Regardless, I'll give it a shot.
In my skimming, I didn't see what versions of Angular it supports. I know that 1.2x has issues with PATCH operations (easily solved), and this didn't have any caveats for $.save() -- is it intended for 1.3+, or could I expect it to work on a 1.2x project?
- aikah 12y agoDjango's ORM still implements the active record pattern,just like this module. I really think it is an anti-pattern especially in domain driven design. Since it basically couples domain models to a persistence library. The repository /model manager pattern is a better alternative as it doesn't care where objects come from and how they are created (used in Hibernate,EF,Doctrine,... ) ,and keeps the persistence layer and domain models totally decoupled. Granted that it is way harder to implement it in javascript+async environment, since async operations are not implicit in JS,which breaks any possible encapsulation to begin with, but it's not impossible.
- goblin89 12y agoThanks for pointing out that active record is a generic pattern. I didn't know that (and judging by angular-restmod's README its author may not know it too). You say active record is anti-pattern, but can't it be combined with managers? For example, in Django, model's save() method eventually delegates to the manager and anything concerning actual DB happens down the line. Angular-restmod doesn't do that, though. I checked its code and it just uses $http directly.
- aswanson 12y agoI want to use RESTangular, but I cant find any thorough end to end examples of usage with mongo.