Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Special characters in t-model causes error #1322

Open
LukeLonas opened this issue Jan 13, 2023 · 0 comments · May be fixed by #1551
Open

Special characters in t-model causes error #1322

LukeLonas opened this issue Jan 13, 2023 · 0 comments · May be fixed by #1551
Labels
bug Something isn't working

Comments

@LukeLonas
Copy link

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']"/>
@sdegueldre sdegueldre added the bug Something isn't working label Jan 13, 2023
LukeLonas added a commit to LukeLonas/owl that referenced this issue Oct 25, 2023
@LukeLonas LukeLonas linked a pull request Oct 25, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants