ember.js - How can catch event after template is rendered at EmberJS? -


i have application uses masonry , ember js attempt search dom element selector, retrieves null seems template rendered. please, me resolve it.

@gjk answer correct, want provide working example: http://jsbin.com/enijad/3/edit

app.indexview = ember.view.extend({   didinsertelement: function() {     var $container = $('#container');     $container.masonry({       columnwidth: 150,       itemselector: '.item'     });   } }); 

the didinsertelement function called when view inserted dom, safe initialize additionally libraries.

also worth mentioning if need clearing after view removed dom in didinsertelement's counterpart hook willdestroyelement.

example:

app.indexview = ember.view.extend({   didinsertelement: function() {     // initialization here   },   willdestroyelement: function() {     // , here can remove stuff safely   } }); 

hope helps.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -