AUR0702
Template compilation error: attribute "yyyy" is invalid on element surrogate.
Error message
Template compilation error: attribute "{{0}}" is invalid on element surrogate.
Parameters
attribute: The name of the invalid attribute found on the surrogate<template>tag.
Error explanation
This error occurs when the template compiler finds certain disallowed attributes on the root <template> tag of a custom element definition. These attributes, including id, name, au-slot, and as-element, cannot be applied directly to the surrogate <template> itself.
Common causes
Adding
id="my-id",name="my-name",au-slot="some-slot", oras-elementdirectly to the<template>tag of a component's HTML file.
How to fix
Remove the disallowed attribute from the root
<template>tag.If you need an
idor other attributes on the component's host element, they should be applied where the component is used, not within its definition's<template>tag.au-slotis used on elements inside a component's template to project content into that component when it's used elsewhere. It doesn't belong on the root<template>.as-elementis valid on regular markup when you want the compiler to treat an element as a specific custom element, but it cannot appear on the surrogate<template>. Move it onto the real element you want to alias, or useas-custom-elementon nested<template>declarations when defining local elements.
Example of Incorrect Usage:
Example of Correct Usage:
Last updated
Was this helpful?