简体   繁体   中英

Strange error when delcall deltemplate in closure templates

I use some delegate templates in the project and I use same approach but in some case i have exception. This is the exception I got:

Exception is 
com.google.template.soy.tofu.SoyTofuException: Found no active impl for delegate call to 'components.TemplateName'

Could somebody explain what is the best way to use delegate templates in soy files.

I found where was my mistake. I was missed ".delegate" in the end of delcall call. Here is some simple scenario:

{namespace somescope}

{template .Template}
  {@param data: ?}
  {@param variant: string}

  {delcall somescope.TransportLeg.delegate data="all" variant="$variant"/}
{/template}

{deltemplate somescope.TransportLeg.delegate variant="'admin'"}
  {@param data: ?}

  <h1>Hello {$data.hello}<a href="{$data.edit}">edit</a></h1>
{/deltemplate}

{deltemplate somescope.TransportLeg.delegate variant="'user'"}
  {@param data: ?}

  <h1>Hello {$data.hello}</h1>
{/deltemplate}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM