@l_tonz wrote:
Hi guys, can someone explain why I can only append to a div if I wrap Ember.run. if I do append, it says cannot append to a view that’s already been loaded. Also, does Ember force you to run DOM manipulation via Ember Run Loop? What is the Run Loop? Thanks ahead of time.
// works actions: { submit(){ let input = $('#chat-textarea').val(); console.log('input', input); this.userSubmit(input); this.botResponse("Oh that's really cool"); } }, userSubmit(response){ let target = Ember.$('#chatroom'); Ember.run.once(function(){ let target = Ember.$('#chatroom'); target.append(response); }); }, // doesn't work actions: { submit(){ let input = $('#chat-textarea').val(); console.log('input', input); this.userSubmit(input); this.botResponse("Oh that's really cool"); } }, userSubmit(response){ let target = Ember.$('#chatroom'); target.append(response); },
Posts: 5
Participants: 3