Let's say I want to implement a lightbox component, which uses <dialog> to render its content. Something like:
@Component({
selector: 'image-popup',
template: `
<dialog>
...
</dialog>
`
})
export class ImagePopupComponent {
...
show(): void {
this.element.nativeElement.showModal();
}
}
If I create an instance of this in the main app component, how can I enable its access from other components. For eg., in some descendant component, I have a button where I want the click to trigger show() on this dialog instance. In my use case, this component will have an imageUrl property, and the same component will be used multiple times to show different images.