@em.b wrote:
Hey All,
I have a model with a hasMany relationship defined. There’s a template that displays data from the model, and a component on the same template that is supposed to display data from the hasMany records from the defined relationship. The user gets to this template by clicking on a {{link-to}} helper that takes the model id as an argument.
I need to do pre-processing on the records in the hasMany relationship. IOW I cannot just rely on template code to display the records - the data must be manipulated in the component and then displayed.
The problem is that I am unable to access the data from the hasMany relationship in the component when the template loads. This seems to be due to delay in loading of those records. If I display raw data from the hasMany relationship using template code, the template is able to understand that the records live behind a promise, and it waits appropriately, then displays the records after they come across the wire.
How can I properly have the component perform the same wait as the template knows how to do? I’ve tried using the afterModel() hook in the route, using a then() in the component, etc. etc. and they have all failed.
What is the proper way to do this?
Posts: 1
Participants: 1