<div>
<external-component>
#shadow-root
<div class="test">
<button value="submit"></button>
</div>
</external-component>
</div>
Want to access submit button. I have tried using ElementRef I am not able to access the element, because it's present under shadowDom. If any one can help me about this.
You can query like below:
constructor(ele: ElementRef){}
//Inside your function
const shadowRoot: DocumentFragment = this.ele.nativeElement.shadowRoot;
const Button = shadowRoot.querySelector('button');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With