VasilioRuzanni / angular-modelizer

Simple and lightweight yet feature-rich models to use with AngularJS apps.
MIT License
26 stars 4 forks source link

Support for HAL #10

Open DoctorEJB opened 8 years ago

DoctorEJB commented 8 years ago

Hi Vasilio -

We are prototyping Spring Data REST / HATEOAS components which produce HAL formatted JSON output. Does or will the Modelizer provide support for HAL? Would be nice if it could seamlessly extract modelizer objects out of the "embedded" HAL output.

VasilioRuzanni commented 8 years ago

@DoctorEJB Well, there is no notion of HATEOAS per se but its pretty agnostic from what shape you have for your API data.

The easy option would be to override the .parse() method for either Model (or your custom model "subclass") or collection. You can parse the data in any way you'd like. Let me know whether that would work or not.

Note on Modelizer: The deprecation warning isn't there just yet but it's actually not maintained anymore (its mostly stable and usable enough, though) despite there was a plan for a rewrite/cleanup.

The reason is dead simple - there is no need for it anymore. There are quite a few much more powerful and expressive patterns for managing client-side state (that is what Modelizer was designed for in the first place - to contain, manage and sync the state, not to be a mere $http or Restangular replacement) have emerged after React and Angular 2 started taking over the arena. Given all that awesome stuff (which entire communities put a lot of effort into), the way Modelizer manages "model" state is by far inferior than other things. The overall concept can now be considered obsolete (well, it works and its simple, it just wound't scale well enough the more app grows and the more edge cases you have).