Skip to content

Possible to access ancestor as a string name in templates? #3382

Answered by augustjk
benfrain asked this question in Q&A
Discussion options

You must be logged in to vote

Within the component, you can do this.getRootNode().host to get the parent, or this.getRootNode().host.getRootNode().host to get the grand parent, and use .tagName for to get the string tag name.

See https://lit.dev/playground/#gist=e3478be76bbaf8935d3a7b1c5846dcf9

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@benfrain
Comment options

Answer selected by benfrain
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants