Ember newb here...
// working with
Ember : 1.13.6
Ember Data : 1.13.7
__
/api/locations
{
"locations":[
{
"id":"1",
"uri":"/location/1",
"name":"ATLANTA"
},
{
"id":"2",
"uri":"/location/2",
"name":"NORTH VIRGINIA"
}
]
}
__
/api/hosts/1/show
{
"id": 1,
"active": true,
"location_uri": "/location/1"
}
A single host includes a reference back to a location but I don't have a location id just the "location_uri" when viewing the host info, which is something I'm hoping I can use to manually look up this record and include in the model when displaying the host show page.
.......I would like to display the location's name instead of this uri and I would like to link it back to the actual location form the host show page. I need some ideas of how to do this?
I think understand how to do find a record in my store like so:
this.store.find('location', {uri: this.model('location')})
but where and when to use is where I'm having trouble. Or even if I just manually made an api call to get the location data and somehow included it in my host show model would be a useful trick.
I'm pretty sure I can't use relationships for this because it doesn't really exist in the JSON right?
Aucun commentaire:
Enregistrer un commentaire