[英]Ember: How to render a template
How to render a certain template by name? 如何通过名称呈现特定模板? Supposed that I have a button, on button clicked event I want to show that template in a modal.
假设我有一个按钮,单击按钮时要在模式中显示该模板。 Can you guys please guide me.
你们能指导我吗?
Not sure if it´s officially deprecated (still working but no longer in documentation @2.3) but you can render any template into an outlet from within a route https://guides.emberjs.com/v1.13.0/routing/rendering-a-template/ 不知道它是否已正式弃用(仍可使用,但在文档@ 2.3中不再可用),但是您可以从路由https://guides.emberjs.com/v1.13.0/routing/rendering-模板/
// .../app/routes/your route
self.render('templatename', {
into: 'parent template which contains the outlet',
outlet: 'outletname',
controller: controller for the template //optional!
});
My modals look like this 我的情态看起来像这样
<div class="modal fade modal-overflow in" id="panel-delete-item" role="dialog" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
{{outlet 'delete_item'}}
</div>
</div>
</div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.