Tom*_*mas 5 javascript ember.js ember-components
{{component-name}}在模板中使用时,渲染组件效果很好.我想使用动态参数从路径渲染组件.我试过这个
App.ApplicationRoute = Ember.Route.extend({
init: function(){
this.render("components/comp-two", {
into: "application",
outlet: "test"
});
}
});
Run Code Online (Sandbox Code Playgroud)
它成功呈现模板,但组件的事件(init,didInsertElement)和操作不起作用.
如何使事件和行动发挥作用?
如果你在 render 方法中给出一些模板名称,ember 只会渲染该特定模板,它不会被视为组件。你可以创建一个虚拟模板,在其中你可以使用你的组件。
我已经更新了您的 jsBin 示例 http://jsbin.com/pajirefeta/1/edit