gpt4 book ai didi

templates - 如何: Closure Template for generating HTML in which attribute value of an element contains curly braces

转载 作者:行者123 更新时间:2023-12-04 03:30:22 25 4
gpt4 key购买 nike

如何获得使用闭包模板创建的HTML?

<input name="fullName" class="large" type="text" data-validate="{required:true, minlength: 5, maxlength:100, messages:{required:'Please provide your Full Name.', maxlength:'This field can contain maximum 100 characters.'}}"/>

任何帮助表示赞赏。

以下是我到目前为止尝试过的方法。
{namespace myApp.test}
/**
* Template for UI of Create User View
* @param userToEdit It is the object returned from GET on User Resource.
*/
{template .testUser autoescape="false"}
{{msg desc="<input id=\"fullName\" name=\"fullName\" class=\"large\" type=\"text\" value=\"{$userToEdit.FullName}\" data-validate=\"{required:true, minlength: 5, maxlength:100, messages:{required:\'Please provide your Full Name.\', maxlength:\'This field can contain maximum 100 characters.\'} }\" />"}}
{/template}

返回 Malformed attributes in tag错误。
{namespace myApp.test}
/**
* Template for UI of Create User View
* @param userToEdit It is the object returned from GET on User Resource.
*/
{{template .testUser autoescape="false"}}
<input id="fullName" name="fullName" class="large" type="text" value="{{$userToEdit.FullName}}" data-validate="{required:true, minlength: 5, maxlength:100, messages:{required:'Please provide your Full Name.', maxlength:'This field can contain maximum 100 characters.'} }" />
{{/template}}

返回 Tag 'template' not at start of line [line 6, column 1].错误。
{namespace myApp.test}
/**
* Template for UI of Create User View
* @param userToEdit It is the object returned from GET on User Resource.
*/
{template .testUser autoescape="false"}
<input id="fullName" name="fullName" class="large" type="text" value="{$userToEdit.FullName}" data-validate="{required:true, minlength: 5, maxlength:100, messages:{required:'Please provide your Full Name.', maxlength:'This field can contain maximum 100 characters.'} }" />
{/template}

返回 template .testUser: Left brace '{' not allowed within a Soy tag delimited by single braces (consider using double braces to delimit the Soy tag) [line 7, column 164].错误。
{namespace myApp.test}
/**
* Template for UI of Create User View
* @param userToEdit It is the object returned from GET on User Resource.
*/
{template .testUser autoescape="false"}
<input id="fullName" name="fullName" class="large" type="text" value="{$userToEdit.FullName}" data-validate="{{required:true, minlength: 5, maxlength:100, messages:{{required:'Please provide your Full Name.', maxlength:'This field can contain maximum 100 characters.'}} }}" />
{/template}

返回 template .testUser: Double left brace '{{' not allowed within a Soy tag delimited by double braces (consider inserting a space: '{ {') [line 7, column 165].错误。
{namespace myApp.test}
/**
* Template for UI of Create User View
* @param userToEdit It is the object returned from GET on User Resource.
*/
{template .testUser autoescape="false"}
<input id="fullName" name="fullName" class="large" type="text" value="{$userToEdit.FullName}" data-validate="{{required:true, minlength: 5, maxlength:100, messages:{ {required:'Please provide your Full Name.', maxlength:'This field can contain maximum 100 characters.'} } }}" />
{/template}

返回 template myApp.test.testUser: Not all code is in Soy V2 syntax (found tag {{print required:true, minlength: 5, maxlength:100, messages:{ {required:'Please provide your Full Name.', maxlength:'This field can contain maximum 100 characters.'} } }} not in Soy V2 syntax).错误。

最佳答案

使用Literal Command就像一个魅力。感谢Jim

{namespace myApp.test}
/**
* Template for UI of Create User View
* @param userToEdit It is the object returned from GET on User Resource.
*/
{template .testUser autoescape="false"}
<input name="fullName" value="{$userToEdit.FullName}" class="large" type="text" {literal}data-validate="{required:true, minlength: 5, maxlength:100, messages:{required:'Please provide your Full Name.', maxlength:'This field can contain maximum 100 characters.'}}"{/literal}/>
{/template}

关于templates - 如何: Closure Template for generating HTML in which attribute value of an element contains curly braces,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7427023/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com