Я хочу передать имя поля в качестве параметра для пользовательской игры! каркасный тег :
#{ifError ${_field}}
<ul class="err">
#{errors ${_field}}
<li>${error}</li>
#{/errors}
</ul>
#{/ifError}
Но все, что я получаю, это исключение:
Template execution error (In /app/views/tags/errorList.html around line 1)
Execution error occured in template /app/views/tags/errorList.html. Exception raised was MissingMethodException : No signature of method: Template_1008.$() is applicable for argument types: (Template_1008$_run_closure1_closure2) values: [Template_1008$_run_closure1_closure2@2da75e1b] Possible solutions: _(java.lang.String), is(java.lang.Object), run(), run(), any(), get(java.lang.String).
play.exceptions.TemplateExecutionException: No signature of method: Template_1008.$() is applicable for argument types: (Template_1008$_run_closure1_closure2) values: [Template_1008$_run_closure1_closure2@2da75e1b]
Как передать параметр в мой тег?
Решение
Я немного изменил решение «Codemwnci» и получил следующий код шаблона:
#{ifError _arg}
<ul class="err">
#{errors _arg}
<li>${error}</li>
#{/errors}
</ul>
#{/ifError}
Этот шаблон называется так #{errorList 'document.title' /}