Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not extend on ajax request #47

Open
mostafasolati opened this issue Jan 18, 2018 · 1 comment
Open

Do not extend on ajax request #47

mostafasolati opened this issue Jan 18, 2018 · 1 comment

Comments

@mostafasolati
Copy link

I want to check request if its ajax or not , then extend the layout.
But this code doesn't work:

`<%: func UserList(userList []string,ajax bool, buffer *bytes.Buffer) %>

<% if !ajax { %>
<%~ "index.html" %>
<% } %>

<%@ body { %>
<% for _, user := range userList { %>


    <%+ "user.html" %>

<% } %>
<% } %>
`

@shiyanhui
Copy link
Owner

Hero doesn't support extends template dynamically. You can write two template, one is for Ajax and the other one not, and then check the ajax value in the handler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants