AUR0704

Template compilation error: Invalid command "yyyy" for <let>. Only to-view/bind supported.

Error message

Template compilation error: Invalid command "{{0:.command}}" for <let>. Only to-view/bind supported.

Parameters

  1. command: The invalid binding command used (e.g., one-time, two-way, trigger).

Error explanation

This error occurs when the template compiler finds an unsupported binding command on an attribute of a <let> element. The <let> element is designed for creating variables within a template scope, and it only supports .bind (for simple assignment or expression evaluation) or no command (which defaults to .to-view / one-way binding). Other commands like .one-time, .two-way, .trigger, .capture, .call, etc., are not applicable to <let> elements.

Common causes

  • Using .one-time, .from-view, .two-way, .trigger, .capture, .delegate, or .call on an attribute of a <let> element.

How to fix

  • Remove the unsupported binding command from the <let> element's attribute.

  • Use .bind if you need to evaluate an expression.

  • Use no binding command for simple one-way binding (.to-view).

Example of Incorrect Usage:

<!-- Error: .two-way is not supported on <let> -->
<let my-var.two-way="someValue"></let>

<!-- Error: .trigger is not supported on <let> -->
<let click-handler.trigger="doSomething()"></let>

<!-- Error: .one-time is not supported on <let> -->
<let config.one-time="initialConfig"></let>

Example of Correct Usage:

<!-- Using .bind (or default .to-view) -->
<let my-var.bind="someExpression"></let>
<let another-var="someStaticValue"></let>
<let user-name.bind="user.profile.name"></let>

Last updated

Was this helpful?