javascript - Ember how do I know when a route template is finished loading and fire a callback? -


currently working on chat app ember, going fantastic ember nice work with.

i have chat window, many lines of people chatting.

i scroll chat window down on initial page load, here's example:

<div class="chat-window">     {{ chat-message username="john doe" message="blah" dispic="unknownuser.jpg" }} </div> 

so how might bind event entire template being loaded (in case index.hbs

i know can components through like:

import ember 'ember';  export default ember.component.extend({   didinsertelement() {     this.$('.button-collapse').sidenav();   } }); 

which works fine, equivalent doing template.

as far know there index.hbs , index.js route file.

any information great thanks.

send action component route. route retrieve data server , after data retrieved route update data.

route can handle loading state. (from guide)

the code that:

import ember 'ember';  export default ember.route.extend({   chatdata:[],   model:function(){       return this.get('chatdata');    },   actions:{       loading:function(){          //do loading...       },       chatdatarequested:function(){           retrievedata().then((datafromserver)=>{this.set('chatdata',datafromserver);});       }   } }); 

Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -