I have a view that renders its template into a named outlet. I use the didInsertElement hook, and there the afterRender schedule to wait for the DOM to complete. However, when I try to access the outcome of this render process, these elements are unknown. If I wrap the access in a setTimeout with time 0 (so that it runs in the next event loop cycle), it works.
App.PlaceView = Ember.View.extend({
didInsertElement: function () {
Ember.run.scheduleOnce('afterRender', this, function () {
// This works
setTimeout(
function () {
// access elements
},
0
);
// Access elements here does not work
});
}
});
What am I doing wrong?