jeudi 6 octobre 2016

How to dynamically create and render a component in Ember JS 1.13+

how can I dynamically create a component in ember 1.13.13. I want to create it programmaticaly, inside another component.

This used to work in Ember 1.11.

var component = this.get('container').lookupFactory("component:my-component");
var view = this.createChildView(component, {param1: 'param1'});
view.createElement();
Ember.$('body').append(view.element);

view.didInsertElement(); // manually call didInsertElement

The same piece of code doesn't work in ember 1.13+, and although it doesn't throw any errors, the component's div element is empty. It is like the template is not rendered. Thanks you for your help.




Aucun commentaire:

Enregistrer un commentaire