I'm developing an Ember-js application where I'd like to link each 'article' to the next and previous article. I want to work according to the JSON API.
I've managed to load/show the article's (blog) author in a decent and to load and show a 'teaser' of the next (related) article. That works fine.
Now, the next piece should be fairly simple: how can I load the 'links' defined in my article? How can I add them to my model or show them in any other way in my Handlebars-template?
Let me give an exerpt from my JSON-repsonse (the payload):
{
"data": {
"type": "blogs",
"id": "5",
"links": {
"previous": "blogs/4",
"self": "blogs/5",
"next": "blogs/6"
},
"attributes": {…},
"relationships": {
…
},
The most important issue is how to get this 'self' link from the JSON reply. Can this data be used straight from the 'model'?
Aucun commentaire:
Enregistrer un commentaire