[英]Emberjs outlet inside a component
It is possible to have an {{outlet}}
helper inside a component ? 组件内部可以有一个{{outlet}}
助手吗?
With a router like this : 使用这样的路由器:
Router.map(function() {
this.resource('pages', function(){
this.resource( 'page', { path: '/:id' }, function(){
this.route('edit');
});
});
});
I'm using my component as pages, and it display a list of page. 我将组件用作页面,并且它显示页面列表。 I have set a {{link-to}}
to each page to render the page template inside my component. 我为每个页面设置了一个{{link-to}}
以在组件内部呈现页面模板。 (Page template is not a component) (页面模板不是组件)
Is it possible ? 可能吗 ? because it's not doing anything, so far my app is routing to /pages/page_id
but the nested template is not display inside my component. 因为它什么也没做,所以到目前为止,我的应用程序正在路由到/pages/page_id
但是嵌套模板未显示在组件内部。
Is outlet not working within a component ? 插座在组件内不工作吗?
Thanks for the help. 谢谢您的帮助。
[EDIT] Here is a small example of what it looks like : [编辑]这是一个看起来像的小例子:
Component : 零件 :
<div class="nestedTemplate">
{{outlet}}
</div>
<div>
{{#each item in model}}
{{partial "list-row"}}
{{else}}
{{partial "no-items"}}
{{/each}}
</div>
The partial is just the list formatted correctly. 部分只是格式正确的列表。 with a {{link-to}}
around each div. 每个div周围带有一个{{link-to}}
。
No, is not possible. 不,不可能。 You can either pass property values to the component or use the {{yield}}
helper. 您可以将属性值传递给组件,也可以使用{{yield}}
帮助器。 See: http://emberjs.com/api/classes/Ember.Handlebars.helpers.html#method_yield 请参阅: http : //emberjs.com/api/classes/Ember.Handlebars.helpers.html#method_yield
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.