My application's index route gets data from server using Ember.$.getJSON(url)
in the route's model hook. The response is then pushed to the store using pushPayload method. When I do foo.get('bars')
where foo
has many bars
(still in the model hook), it results in empty bars. Seen from the server's response and the ember inspector though, the foo's bars actually have some data. So I investigated the foo.get('bars')
using chrome's console, and found out the bar records are loaded in its canonicalState property. So my workaround is to use foo.get('bars.canonicalState')
instead.
So far its working good, but since it feels hacky and I can't find the canonicalState property in ember's documentation, I would like to know if this is the right way of doing it? and why does this happen?
foo
model and the json payload? – albertjan