jquery - Ember event rendering property in dom -


i have standard ember view template.

template:

<script type="text/html" data-template-name="template">   <div id="container">     <p>{{{view.description}}}</p>   </div> </script> 

view:

em.view.extend({   templatename: 'outlooksnapshotinformationtemplate',   description : "loooooong text...",   descriptionchanged : function(){     $('container').height()     [...]   }.observes('description') }), 

i want dimension of container div, using jquery using descriptionchanged observer.

the problem description value asynchronous , updated before rendering of page.

there event raised on specific property in template re-rendered in dom?

inside of observer, interact dom inside of call ember.run.scheduleonce().

http://emberjs.com/api/classes/ember.run.html#method_scheduleonce

this ensures given code runs after render queue has been flushed, , further run once if happen update description multiple times in current run loop:

ember.run.scheduleonce('afterrender', this, function () {   var height = this.$('#container').height();   // ...   // profit! }); 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -