jeudi 15 mars 2018

EmberJs - how to iterate included json data

the backend api is returning a sideloaded data like the following:

{
   "data":    {
      "type": "rsvps",
      "id": "e47e8358-0f18-4607-b958-2877155bf5be",
      "attributes":       {
         "user_id": "e47e8358-0f18-4607-b958-2877155bf5be",
         "name": "Foo bar"
      },
      "relationships": null
   },
   "included":    [ // I want to print this array of data
            {
         "type": "events",
         "id": "78e399ac-645a-4e51-90f4-278b2cd27b2c",
         "attributes":          {
            "event_id": "78e399ac-645a-4e51-90f4-278b2cd27b2c",
            "name": "event 1"
         }
      },
            {
         "type": "events",
         "id": "ec93f9c4-757d-4ff8-8fdc-31bc3cca07b5",
         "attributes":          {
            "event_id": "ec93f9c4-757d-4ff8-8fdc-31bc3cca07b5",
            "name": "event 2"
         }
      }
   ]
}

In the .hbs file, how can i print out the included data?




Aucun commentaire:

Enregistrer un commentaire