ember.js - Ember data hasMany records loaded only in the canonicalState property -
my application's index route gets data server using ember.$.getjson(url)
in route's model hook. response pushed store using pushpayload method. when foo.get('bars')
foo
has many bars
(still in model hook), results in empty bars. seen server's response , ember inspector though, the foo's bars have data. investigated foo.get('bars')
using chrome's console, , found out the bar records loaded in canonicalstate property. workaround use foo.get('bars.canonicalstate')
instead.
so far working good, since feels hacky , can't find canonicalstate property in ember's documentation, know if right way of doing it? , why happen?
in controller
, try following...
... mybars: ember.computed.map('foo.bars', function(bar) { return bar; }), ...
then should able access mybars
constructed array of bar
objects.
Comments
Post a Comment