-
Notifications
You must be signed in to change notification settings - Fork 113
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
Passing variables to decorator #32
Comments
That should already be possible. I haven't documented it, but I use |
It doesn't work for me. Try the view above with this decorator <body>
<h1 th:text="${hello}">Hello</h1>
<div layout:fragment="content"></div>
</body> Result is <body>
<h1></h1>
<div>...</div>
</body> Thymeleaf version 2.1.0, layout 1.2 |
Cool, I'm able to make a test case that duplicates this behaviour. It looks like without the |
Fixed for the next version of the layout dialect. Test file: FragmentVariablePassing.thtest |
If you (or anybody watching this issue) need to use this fix right now, I've just uploaded a 1.2.2-SNAPSHOT version with it. |
Is it possible to declare the variables in the decorator and giving them default values? layout
page
or
|
Been a while since I tried to see how merged attribute behaviour would work, but you should be able to declare values in the decorator with plain old |
I tried that and the value declared in the decorator always wins. If I don't declare it, the one in the decorated page is used. So it's not possible to have default values in the decorator. Another problem I have with not being able to declare them in the decorator is that you have to search for them in the HTML code before you can use them. If they were declared at the top of the decorator, it would be easier to know what variables can be used. |
Please allow passing variables to parent decorator with
th:with
like this:The text was updated successfully, but these errors were encountered: