Templates 使用条件呈现挂起的模板,我们使用的是哪个父模板
我想有条件地显示一个较大的模板内的模板,只要存在较大的模板是真的 在sidebar.hbs中Templates 使用条件呈现挂起的模板,我们使用的是哪个父模板,templates,ember.js,conditional,render,routes,Templates,Ember.js,Conditional,Render,Routes,我想有条件地显示一个较大的模板内的模板,只要存在较大的模板是真的 在sidebar.hbs中 <div id="sidebar-wrapper" class="super-super-float-right-col"> <div id="sidebar-wrapper" class="super-float-right-col"> <div id="sidebar-wrapper" class="float-right-col"> {{
<div id="sidebar-wrapper" class="super-super-float-right-col">
<div id="sidebar-wrapper" class="super-float-right-col">
<div id="sidebar-wrapper" class="float-right-col">
{{#if permit.id}}
{{render 'applicant'}}
{{render 'location'}}
{{else}}
<h2>Nope!</h2>
{{/if}}
</div>
</div>
</div>
{{{#如果允许.id}
{{呈现“申请人”}
{{呈现“位置”}
{{else}
不!
{{/if}
在application.hbs中,我称之为侧栏和出口
{{render sidebar}{{outlet}}
因此,从技术上讲,侧边栏目前与{{outlet}的结果无关
我想连接{{outlet}}的结果,在sidebar.hbs中用它呈现模板
现在我得到的是“不!”
编辑:我可以使用{{#if this.id}}使permit.hbs页面上的条件为真。现在,我试图找出如何将相同的逻辑应用于渲染
非常喜欢,伊恩,在应用程序中。hbs您拥有应用程序控制器的属性。因此,在ApplicationController中,您应该为是否显示侧边栏进行逻辑操作。可能重复我的想法,因为我完全将整个问题改写为一个新问题,所以它值得一个新主题。但是,我不想删除上一个问题的信息。这是一种什么样的逻辑?您可以在应用程序控制器中设置一个可以从application.hbs访问的属性。sidebar.hbs中的所有属性仅访问sidebar控制器属性。也许你可以用更多的代码设置一个js垃圾桶?