[英]Ember.js “template to render” versus “template to render into”
在Ember.js的有关渲染模板的指南的最后一个示例中,它说:
App.PostRoute = App.Route.extend({
renderTemplate: function() {
this.render('favoritePost', { // the template to render
into: 'posts', // the template to render into
...
这是否意味着“要渲染的模板”是“要渲染的模板”内的{{部分}} , {{出口}} , {{渲染}}或{{模板}} ?
如果不是,是否有人可以给出一个带有路由和模板的示例,以区分“要渲染的模板”和“要渲染到的模板”,并说明如何在this.render()
使用它们?
要渲染的模板是车把模板名称。 如果您未指定一个Ember,则将假定模板名称与路由名称相同:“ post”。 在这里,您指定了“ favoritePost”作为模板名称。
要渲染到的模板决定了在何处渲染“ favoritePost”模板。 默认值为“应用程序”模板上的{{outlet}}。 在这里,您已指定“ favoritePost”模板应呈现到“ posts”模板中的{{outlet}}中(应该是祖先路线)。 这样,您可以嵌套数据:所有帖子的列表和所选帖子的视图等。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.