Reputation: 44371
I have a model which has a belongsTo
field, but that field is not getting initialized. I would like to see the full object content (on the javascript console) right before the template accesses the view / controller.
Is it possible to tell ember to dump the view / controller values on the console, for all objects being rendered?
Upvotes: 1
Views: 96
Reputation: 23322
What you might also beeing able to do, is to listen to your record's didLoad
event. This will be fired when all the record data has beeing fetched from the backend (even belongsTo
relations assuming you have defined the relations with {embedded: 'always'}
):
record.on('didLoad', function() {
console.log(record);
});
Note from the docs: A record that is both loaded and clean means that is has received information about its attributes and relationships from the server, and no changes have been made locally on the client.
But for debugging purposes only Mike Grassotti's answer is also a good option.
Hope it helps
Upvotes: 3
Reputation: 19050
It's possible. Probably the fastest thing to do is use handlebars {{log}}
helper. It will log the value of a specified object to console during render:
{{log this}}
If debugging a specific ember-data model, you might also consider enabling logging state manager transitions on it:
record.set("stateManager.enableLogging", true)
Upvotes: 3