Closed anthonyma94 closed 14 hours ago
Hello @anthonyma94,
It's hopefully fixed in version 0.0.7 released this morning. Could you tell me if it's OK for you?
Thanks for the quick response! I'm getting a different error for objects: Uncaught (in promise) SyntaxError: unexpected token: ':'. Arrays seem to be fine with my limited testing.
default:
- testing:
text: hello
card:
type: custom:mushroom-title-card
title_javascript: "'[[testing]]'.text"
That's normal, this is not valid javascript: it transposes to: {"text":"hello"}.text
which is invalid in JavaScript. You can test in the console.
If you have such need, you probably need this template:
default:
- testing:
text: hello
card:
type: custom:mushroom-title-card
title_javascript: "('[[testing]]').text"
Basically, the parenthesis will instantiate the object for real and then you are able to get its properties.
Closing as resolved. Do not hesitate to reopen the issue if necessary.
Describe the bug
When using JavaScript templates, referencing non-primitive variables (objects & arrays) will result in errors. The error depends on the parser, but nothing will act as expected.
To Reproduce With these variables:
This works:
But this doesn't:
Expected behavior I expect both options to work.