Strange error when delcall deltemplate in closure templates

128 Views Asked by At

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.

1

There are 1 best solutions below

0
On

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}