[英]Geddy.js - rendering partial views without layout, is it possible?
Is it possible to render a partial view in Geddy.js without rendering the entire HTML page layout? 是否可以在Geddy.js中呈现部分视图而无需呈现整个HTML页面布局?
self.respond(model, {layout: false, template: 'app/views/users/_list'});
I've tried to do this with no success. 我尝试这样做没有成功。 (Although the documentation says: "layout [false]: a flag to not use a layout file") (尽管文档说:“ layout [false]:不使用布局文件的标志”)
For future reference, you can pass false
into the layout, which will not use a layout from file. 为了将来参考,可以将false
传递到布局中,该布局将不使用文件中的布局。
http://geddyjs.org/documentation#controllers.respond http://geddyjs.org/documentation#controllers.respond
Okay. 好的。 I finally made an "empty" layout called empty.html.ejs
: 我终于做了一个名为empty.html.ejs
的“空”布局:
<%- yield(); %>
Then I used it like this, in the appropriate controller action: 然后我在适当的控制器操作中使用了它:
..., {layout: 'app/views/layouts/empty', ...
It seems to be a hack, but at least it is a working solution... 这似乎是一个hack,但至少这是一个可行的解决方案...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.