You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It there a way to use template repeat to instantiate an arbitrary number of various custom elements based on input data? Here is pseudo-code describing what I'm trying to achieve:
I guess something like this could work, but if my data supports up to 1000 different node types, I would need an equal amount of if statements to make it work. Is there a more elegant way of doing this?
Another technique I tried was to make a custom element specifically for instantiating elements of certain type (like some sort of wrapper). The element would use document.CreateElement('node_type') and add it to it's shadowRoot. The problem with this was element.ready() would fire before the element was inserted into the DOM.
The text was updated successfully, but these errors were encountered:
It there a way to use
template repeat
to instantiate an arbitrary number of various custom elements based on input data? Here is pseudo-code describing what I'm trying to achieve:I guess something like this could work, but if my data supports up to 1000 different node types, I would need an equal amount of if statements to make it work. Is there a more elegant way of doing this?
Another technique I tried was to make a custom element specifically for instantiating elements of certain type (like some sort of wrapper). The element would use
document.CreateElement('node_type')
and add it to it'sshadowRoot
. The problem with this waselement.ready()
would fire before the element was inserted into the DOM.The text was updated successfully, but these errors were encountered: