-
I am starting out with lit and have issues passing objects or lists to attributes. From reading the docs I have to put a this here passes two undefined objects to
while this here works and passes an array of two objects to
My component is pretty simple like so:
What am I missing here? Or do I have to pass the objects/arrays in a different manner if I come from plain html? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I just found this hint in the docs:
So, changing the code to this, now finally passes objects.
Now that I see it, it does make sense, as attributes can only contain text and putting a valid json string in there will parse the values the right way. Here is the docs in question: |
Beta Was this translation helpful? Give feedback.
I just found this hint in the docs:
So, changing the code to this, now finally passes objects.
Now that I see it, it does make sense, as attributes can only contain text and putting a valid json string in there will parse the values the right way.
Here is the docs in question:
https://lit.dev/docs/components/properties/#conversion-type