Skip to content

Special characters in t-model causes error #1322

@LukeLonas

Description

@LukeLonas

Issue:

When you try to access a property that has a special character via t-model you get the following error:
Uncaught (in promise) Error: Invalid t-model expression: "obj.$hello" (it should be assignable)

I'm not sure if this is expected or not. I wanted to create this issue because the error message had me scratching my head for a little while. It doesn't seem to be consistent with what works in something like a t-esc. I can always access the property with the [] notation (as shown in the workaround below), and that handles the special characters without a problem.

Javascript:

  setup() {
    this.obj = useState({"$hello": "world"});
  }

Template:

  <input t-model="obj.$hello"/>
  <p t-esc="obj.$hello"/>

Workaround:

  <input t-model="obj['$hello']"/>

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions