AUR0810
Error Message
AUR0810: Invalid [else] usage, it should follow an [if]
Description
This error occurs during template linking when an else attribute cannot link to a valid preceding if or else if controller. Conditional branches are an adjacent authoring construct: place each else directly after the branch it continues.
Cause
Incorrect Placement: The element with the
elseattribute is not placed immediately after the correspondingif.bindorelse ifbranch. Another controller-bearing structure between branches breaks the chain.Missing
if.bind: The preceding element, which was intended to be the start of the conditional block, is missing theif.bindattribute.Invalid
else ifStructure:else ifmust keepelseandif.bindadjacent on the same element. Plain attributes or non-template-controller custom attributes may appear between them. Another template controller means the attributes do not form anelse ifbranch.Template Manipulation: Manual manipulation of the DOM or compiled template structure before or during linking might disrupt the expected
if/elsesequence.Syntax Error: A simple typo or syntax error in the template might lead to the
elsebeing misinterpreted or misplaced relative to theif.
Solution
Verify Placement: Ensure the element with the
elseattribute is the immediate sibling following the element withif.bindor a precedingelse ifbranch. Remove any intervening elements that break the chain.Add
if.bind: If the preceding element is missingif.bind, add it with the appropriate condition.Check
else ifSyntax: If you want anelse ifbranch, put adjacentelseandif.bindattributes on the same element.Check Template Structure: Review the HTML template carefully around the
if/elseblock for any structural issues or typos.
Example
Debugging Tips
Inspect the source template around the
ifandelseelements. Pay close attention to the direct sibling relationship.Verify the branch order in the source template. Template controllers compile into nested controller views, so the rendered DOM is not a reliable representation of the original branch relationship.
Temporarily remove the
elseblock and confirm that theifbranch works on its own.Simplify the branch content to rule out another template controller changing the structure.
Last updated
Was this helpful?