Note that there are some explanatory texts on larger screens.

plurals
  1. POHATEOAS client with AngularJS
    text
    copied!<p>I was wondering if there were any features hidden in Angular or exposed by some 3rd-party libraries to easily create HATEOAS-compliant Restful clients.</p> <p>On backend side, I am using Spring Data/REST to produce an HATEOAS JSON API. Consuming it, though, is quite another story. </p> <p>For instance, I've got those 3 entities: </p> <ul> <li>Company <code>{name, address}</code> </li> <li>Employee <code>{firstName, lastName, employer[Company]}</code> </li> <li>Activity <code>{rate, day, employee[Employee], client[Company]}</code></li> </ul> <p>and requesting an activity (the most complex entity of the model) produces something like this:</p> <pre><code>{ links: [], content: [{ rate: 456, day: 1366754400000, links: [{ rel: "self", href: "http://localhost:8080/api/activities/1" }, { rel: "activities.activity.client", href: "http://localhost:8080/api/activities/1/client" }, { rel: "activities.activity.employee", href: "http://localhost:8080/api/activities/1/employee" }] }] } </code></pre> <p>My API talks in terms of REST (resources identified by links). An Activity has an Employee for instance. What I really want to use is : <code>{rate: 456, day: 1366754400000, employee: {firstName:"xxx", lastName:"xxx" ...}}</code>.</p> <p>However, as you can see in the first output, my Activity only contains a <em>link</em> to the employee, not its data. Is there anything in Angular or in a 3rd-party library to resolve those links and embed the resulting data instead?</p> <p>Any input on this?</p> <p>Thanks in advance!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload