Want to dynamically insert a new template into the DOM with Ember? You can create a new view and append it to the DOM using Ember.View’s append or appendTo methods.
1 2 3 4 5 6 7 8 9 10 11 | App.MyView = Ember.View.extend({ templateName: 'a_template' }) var view = App.MyView.create(); // Append the view to the document body view.append(); // ...or append to any element described using // a jQuery-compatible selector. view.appendTo('#my-div'); |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.